Changing frames on a button

Hello, I was going to make a level select frame in my game, and to unlock the different level, you need to complete the previous level. I've done this, but I also want an effect on my button. So if level1 completed=true, it goes red, but if it's false, it goes gray. For a movieclip, I would have used
onClipEvent (enterFrame) {
          if (level1 == true)
    this.lvl1btn.gotoAndStop(2);
But that's only for movieclips, so do I have to make a pressable movieclip, or is there another way?

If you want a button that will stay in different states you need to use a movieclip as a button.
Just a tidbit else...
if(level1 == true)
can be reduced to 
if(level1)
conditinals work based on evaluating whether what is in the parentheses is true or false, so for Boolean values you don't need to use   == true/false

Similar Messages

  • How do I make my flash banner change frames on a timer?

    Hello, I'm new to flash and I recently just made a flash banner where you can click buttons to change frames. I also want to add the ability for it to automatically change frames after 7 seconds. I've put all of the pictures on the same frame and gave them frame labels. What would be the actionscript code I should use to make this work, along with making the buttons still functional? Also, how can I put buttons to go to the last frame from the first, and first to the last, while still making them stop at every frame? I keep trying and nothing's working.
    If you'd like a more in-depth look, I've provided the .FLA file here:
    http://uppit.com/v/ZJOKIQ59
    The easiest way to explain it would be to re-upload an .FLA file with all of the above completed bug-free, and show me how you did it. I hope I'm not asking too much with that, but I would be able then to take a look at it and compare it to my code to learn it myself.
    Thanks in advance for any help! =]

    Well I done some more work this time. As i had some problems uploading files I'v made these screanshots.
    - On the first frame add just this:
    var secTimer:Timer=new Timer(1000,7);
    startTimer();
    - The actual code is on the second frame:
    //secTimer.addEventListener(TimerEvent.TIMER, tik);
    secTimer.addEventListener(TimerEvent.TIMER_COMPLETE, skipFrameT);
    next_btn.addEventListener(MouseEvent.CLICK, playNextFrame);
    function playNextFrame(e:MouseEvent):void {
    if(currentFrame < 50){
    resetTimer();
    play();
    else{
    resetTimer();
    gotoAndPlay(2);
    prev_btn.addEventListener(MouseEvent.CLICK, previousFrame);
    function previousFrame(e:MouseEvent):void {
    if(currentFrame <= 11){
    gotoAndPlay(42);
    else{
    gotoAndPlay((currentFrame-10));
    resetTimer();
    /*function tik(e:TimerEvent):void {
    trace("frame ",currentFrame,", tick", secTimer.currentCount);
    function startTimer():void {
    secTimer.start();
    //trace ("timer Started");
    function skipFrameT(e:TimerEvent):void {
    //trace ("time stoped");
    if(currentFrame < 50){
    play();
    else{
    gotoAndPlay(2);
    resetTimer();
    function resetTimer() {
    trace("Timer Reseted");
    secTimer.reset();
    startTimer();
    - Remove your code for the buttons;
    - And use 10 frames spaceing for the images:
    2 to 11; 11 to 21; 21 to 31... and so on.
    Hope this will be real help now.

  • Changing frames within a symbol

    Can anyone tell me how to change frames within a symbol, by using a button in the actuall stage. Every time I try searching for it, I get lost in half compleated answers, action script 2, and things that throw a ton of code and words and stuff at me, but never explain the parts of it. (Often also has losts of additional code that I probally don't need)
    I've got the button, but I need the function.

    I can see from your other posts you are familiar with coding a button, so... In your button event handler function you would use something like...
    symbolName.gotoAndStop(someFrame);
    where symbolName is whatever instance name you assign to the movieclip symbol and someFrame is either a number or a label for the frame you want to change to.

  • PrE 9.0 wont let me share as H.264 1280x720p 29.97 fps - keeps changing frame rate

    As the title says I am unable to create an export with the following settings:
    H.264
    1280x720p
    29.97 (or 30, neither possible) fps
    I have tried editing the existing H.264 presets but the following happens:
    I go into Share > Computer > MPEG and select the Preset "H.264 1440x1080i 30" then hit the "Advanced" button.
    All I want is to change the resolution to match my project size, 1280x720 which I do - but then something happens
    As soon as I change "Frame Dimensions (pixels)" to 1280x720, the fps is automatically changed to 59.94 and when I click the dropdown box for the frame rate, I can only pick the following:
    23.976
    24
    59.94
    Automatic (based on source)
    Since I can't pick 30 or 29.97 I tried picking Automatic but that sets it to 23.976 - even though it clearly states that my source is at 29.97 fps...
    At this point I don't really know what else to try and any help is appreciated.
    Thanks
    EDIT: Just thought I'd also mention that the source is from a GoPro Hero HD cam which shoots in 1280x720 H.264 AVC so I did select "NTSC AVCHD LITE 720p30" as the project profile
    EDIT2: Found Bill Hunt's premade profiles for the GoPro and Premiere Pro. Trying them out right now and it seems to be working. But I still cannot create a profile with 29.97 fps at 1280x720 myself

    With certain file formats and codecs, you will be limited in the configuration of size or frame rate. It sounds like the output format you've selected is one of them.
    Try going to Share/Computer/MOV and see if that makes a difference.

  • Creating a plot on a java Frame when a button is clicked

    hi
    I want to create a plot in a java application in a frame when a button is clicked.I mean to say a
    a plot between two single dimensional arrays one as x-axis and the other as y-axis. Can u please suggest me with an example
    Thank u

    JFreeChart

  • I want to play video on my computer to make some analysis to frames,the problem that I face ,I can't change video frame rate using labview,but I can change frame rate to the video out of labview using some program

    HI All
    I want to play video on my computer to make some analysis to it's frames,the problem that I face ,I can't change video frame rate using labview,but I can change frame rate to the video out of labview using some program .
    I used IMAQ AVI Read Frame VI
    for example I have avi video It's frame rate is 25 fbs ,my image processing code is very fast that can process more 25 fbs,so I want to accelerate video acquisition

    Hi abdelhady,
    I looked into this further, and reading an AVI file into LabVIEW faster than its frames per second won't be possible. LabVIEW could read in frames faster than 25fps, but because it will be pulling the available frame at that point in time this would just give you duplicate frames. If you want to be able to read in frames at faster than 25fps, you would need to speed up your AVI file before reading into LabVIEW.
    There's a good shipping example to show how to read in from an AVI file, "Read AVI File.vi". You'll notice that they add timing to make sure that the while loop runs at the right speed to match up with the frames per second of the file being read. This is to make sure you're not reading duplicate frames.
    Thank you,
    Emily C
    Applications Engineer
    National Instruments

  • When reflow text; How to change paragraph automatically when changing frame

    Hi
    Im new to indesign scripts, but thought that this maybe was the right forum to ask the following question. (Im using Adobe Indesign CS.5 )
    Im currently trying to import a file (word file / excel both is possible) into an indesign book and formatting the text automatically!
    My question is: How is it possible to reflow text into frames and when changing frame it changes paragraph?
    I have already figured out how to reflow the text, and actually also managed to relow text into the frames and change paragraph style. I know how to use the keep option, and by this change the paragraph style when e.g. changing frame break/page break etc.  (but if the content being flowed-in is not tagged with style names then I cannot figure out how to do it)
    The document and its content I whish to import do not have any tagged paragraphs!
    If any of you have a hint, I would be more than happy to hear from you

    My question is: How is it possible to reflow text into frames and when changing frame it changes paragraph?
    This question is not gramatically correct and I cannot understand what you are trying to ask.

  • AS3 Timer to change frames not working correctly. PLS help

    HI I am having a big of trouble with this code to change frames on my timeline. I thought my code below would work fine but its not. For some reason it will go to frames 1-4 (4 is the last frame) then it will go back to 1 again just fine as its supposed to... but then will jump to 3 then back to 1... all random instead of staying in sync.  I have attached both my as2 version and my as3 version. My as 2 is working perfectly. I can define the amount of time a frame will pause for on each frame. ... the as3 though I am having no luck. Any help or advice would be appretiated! Thank you
    here is my as 3 code;
    stop();
    var frameTimer:Timer = new Timer(1000);
    frameTimer.addEventListener(TimerEvent.TIMER, frameChange);
    function frameChange(e:TimerEvent):void
        if(currentFrame == totalFrames)
            gotoAndStop(1);
        else
            nextFrame();
    frameTimer.start();
    here is my as 2 code;
    stop();
    function GotoFrame ()
        StopTimer ()
        var frame:Number = _root._currentframe;
        var total:Number = _root._totalframes;
        var Next:Number = (frame % total) + 1;
        _root.gotoAndStop (Next);
    function StartTimer (Time)
        _root.myTimer = setTimeout (GotoFrame, Time);
        _root.stop ();
    function StopTimer ()
        clearTimeout (_root.myTimer);
        delete _root.myTimer;
    StartTimer (1000);

    Oh I didn't think about that! ... I suppose it is ok to overlook things like this while im still learning
    Thanks for that answer. Perfect! .. that was driving me crazy.
    any chance you could help me solve the next task of defining the amount of time each frame will pause on each frame. In my action scrip 2 code I could put timerFunctioName(5000); and it would pause only that frame for that amount of time and I was able to put different time pauses on each frame in this way.

  • How to change color of a button for specific time interval in jsp

    How to change color of a button for specific time interval in jsp.
    Please help.
    Thanks in advance.

    This was driving me crazy, too--and the previous answers did not seem to work. I eventually found that if I click one of the data symbols in the graph in exactly the right spot (see below), it selects only the data symbols and not the line. I can tell this because the little selection dots will be around each data symbol, but no selection dots will be on the line between the data symbols - like the graphic in Yvan's answer. Then and only then will the color symbol in the tool bar show the color of the data symbol, instead of the color of the line. I believe that you then have to first click on the color swatch in the toolbar and then select your color (or choose Show Colors and select from the color tool). Just clicking a color in the crayon box, for example, did not seem to work unless I first clicked on the color swatch in the toolbar, then clicked Show Colors on that dropdown, and +only then+ clicked the crayon or whatever.
    _The right spot to click_ seems to be just above the exact center of the data symbol, at least for the diamond shape symbol that I prefer. Sometimes it takes several tries to hit the right spot. If I miss it, the whole line is selected, which is indicated by the little selection dots on the line, between the data symbols. When I click the right spot, those selection dots go away, leaving only the data symbols selected. Then I can change the color, as described above.
    I hope this works for you too.

  • Theme colors - Change the color of buttons

    Hi
    I went through the tuttorial, "Adding Styles to Components"
    I were able to change different properties of buttons by creating a Style Class with the same name as that of the theme but with different style attributes.
    This had the desired effect except for the background color.
    I played around abit with the style editor settings of a button with a theme applied on it, and found that when you are in the background tab of the editor and you select your desired new color, that there are no changes EXCEPT for when you select the " Repeat-y" from the "Tile" drop-down list. Only problem is you get a funny stripe through the middle of the button.
    Is this the only way to change the color of buttons, linked to a theme, to a new color?
    Any Advise
    Thank you

    To find the style properties defined in class Btn2, go to the theme's read-only css_master.css file:
    In the Projects window, expand Libraries > Default Theme > com.sun.rave.web.ui.defaultheme.css.
    Double-click the css_master.css file to open the file.
    Search the file for the style class of interest, such as Btn2.
    For example, to set a Btn2 background-color, both background-color and background-image must be defined to override the existing style class. Since you cannot make edits to the read-only css_master.css, use the style property editor to set the background-image to null and the background-color to the one desired for your component.

  • Changing a selection of buttons on a template

    Hello.
    I have created a template for sub menu that I use on a constant basis. each button on the menu has a drop shadow...
    I was wondering if there is a way to select all of them at once and remove that shadow?
    I will have anywhere from 1-10 sub menus and it is time consuming for me to remove it button by button with 12 buttons on each menu....
    any ideas?

    changing the number of buttons doesn't seem like a good idea
    it's quite simple like this
    a grid 7 x 7
    first row for S M T W T F S
    the next 6 x 7 for 'locations' of the various days of the month
    program opens, builds gui, and determines currentMonth
    method setDays() called which
    - sets text of 6 x 7 to ""
    - determines days in currentMonth
    - determines dayOfWeek of 1st day of currentMonth
    - sets text of button[7+dayOfweek] to 1, then next button to 2, then 3 etc to daysInMonth
    buttons next/previous add/subtract 1 to/from currentMonth, and setDays() called again
    changing the button text calls repaint(), so no need to call it yourself.
    the above is from memory, so text positions could be off by a day, but it's a basic
    routine, and with a bit of experimentaion, should do what you want

  • Change text for radio button

    Hi all,
    Can we change text of radio button in selection screen after pressing push button?
    On screen, I will have push button for user to select one of two conditions, after selecting, I want radio button text be changed, for example : text > 'upload' will be changed to become 'upload sales'.
    can we?
    thanks
    Alia

    Hi alia,
    1. Very simple.
    2. The Important thing is
        NAME of the RADIO BUTTON.
    eg. name is XYZ.
         then we can access it in program like this :
        %_XYZ_%_app_%-text = 'Hello Sir'.
      (Please note the FORMAT - Its important)
    3. try this code (just copy paste in new program)
      IT WILL CHANGE TEXT OF RADIO BUTTONS
      WHEN PUSHBUTTON IS CLICKED.
    REPORT abc.
    PARAMETERS : abc  RADIOBUTTON GROUP g1,
                 xyz  RADIOBUTTON GROUP g1.
    SELECTION-SCREEN : PUSHBUTTON /15(25) pb USER-COMMAND pp .
    ABC, XYZ
    AT SELECTION-SCREEN .
      IF sy-ucomm = 'PP'.
        %_abc_%_app_%-text = 'Hello Sir'.
        %_xyz_%_app_%-text = 'How are u ?'.
      ENDIF.
    regards,
    amit m.

  • Support MIDI and dynamic change FRAME RATE

    What MACROMEDIA says about support by FLASH, midi files and
    dynamic change FRAME RATE of the movie?
    this is two nuances that does not suffice me.
    And what about macromedia FLASH 9? When it comes?

    For dimension changing use something like this (is a part of a bash script for video edition so ...) :
    # Le quitamos el over-scan al ancho. OJO!! debe seguir siendo MULTIPLO de OCHO
    WIDTH_SCALED=$(($OUTPUT_V_WIDTH-$OUTPUT_OVS*8)) #multiplicamos el overscan por 8(4 pixeles a cada lado)
    # Obtenemos relacion de aspecto de forma mas precisa
    if [ "$OUTPUT_V_ASPECT" == "1.7777" ]; then # formato panoramico
    ASPECT_PRECISE=`echo "16/9"| bc -l`
    else
    ASPECT_PRECISE=`echo "4/3"| bc -l` # y el formato normal
    fi
    HEIGHT_SCALED=`echo "(${INPUT_V_HEIGHT}*${OUTPUT_V_HEIGHT}*${ASPECT_PRECISE})/${INPUT_V_WIDTH}"| bc -l`
    # Necesito que el alto sea MULTIPLO DE CUATRO para que la longitud del PADDING sea PAR y simplificar el codigo... introduzco un error de 3.999999 pixels (en el peor de los casos)
    HEIGHT_SCALED=$((`echo "scale=0 ; $HEIGHT_SCALED/4"| bc -l`*4))
    # Calculo el Padding
    OUTPUT_V_PAD_WIDTH=$(($OUTPUT_OVS*4))
    OUTPUT_V_PAD_HEIGHT=`echo "scale=0 ; ($OUTPUT_V_HEIGHT-$HEIGHT_SCALED)/2"| bc -l`
    Don't bother about the comments . Is spanish .
    What you want is :
    HEIGHT_SCALED=`echo "(${INPUT_V_HEIGHT}*${OUTPUT_V_HEIGHT}*${ASPECT_PRECISE})/${INPUT_V_WIDTH}"| bc -l`
    About frame rate - this is video edition and i think you can not do this in java . Is more complicated than a simple calc . Under linux i'm using ffmpeg to change fps and encode from avi to mpeg2 .

  • Changing scroll bars to buttons

    Hello all, I use Macromedia Dreamweaver Mac for my wepage
    editing, I was wondering if anyone knows any helpful tutorials or
    instructions on how to replace the ugly grey scroll bars in your
    frames with arrow buttons or the like. Thanks much !!

    You can control the colours of the scroll bar elements using
    CSS which means you can effectively 'hide' the scroller etc. You
    can find more info here:
    http://websitetips.com/articles/css/scrollbars/
    You can do it .... but should you? I'd agree with Micha,
    avoid it if possible and perhaps revisit your design, i dislike
    having many scrollables within a page especially when the
    containers are not dimensioned relative to thier content (don't
    make me scroll when I shouldn't have to).
    Karen

  • Gray frame around flash buttons and more...

    Hi,
    1.I've used flash buttons in my home page,the problem is
    that when u view the page with explorer u see a gray frame around
    the buttons...
    It is so ugly...some one knows how to fix it without using
    the code?
    2. Another problem, the behevior "show pop up menu" is not
    valid,
    i've used it before on that page....
    i tried everything... i saved it ,linked it...
    i dont know what is the problem...
    thank you....if you can help
    Racheli

    I'm experiencing the same problems with my flash buttons. As
    you hover over them initially, a gray border surrounds them and an
    alt tag pops up that says "click here to activate this control."
    This confuses some of the visitors, becuase they perceive this as
    if the buttons do not work. I suspect it may be a browser specific
    problem...are there any quick fixes for this? Thanks for the help.
    --Daniel Serna
    Knight Aerospace Products, Inc.

Maybe you are looking for