this should be REALLY easy....but it's not working
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: this should be REALLY easy....but it's not working

  1. #1
    Member
    Join Date
    Jun 2003
    Location
    sunny SoCal
    Posts
    76

    this should be REALLY easy....but it's not working

    I was trying to control a popup textbox with AS, but I couldn't get the tween to reset and be reused. Finally gave up and just animated the text box to pop up instead. I am able to get it to play if I use
    Code:
    Object(this).popUpAnim_mc.gotoAndPlay("anim");
    however, as soon as I put it in a function, it stops working. The trace, however does come up so the function itself is fine.
    Code:
    this.addEventListener(Event.ENTER_FRAME,popAnim);
    function popAnim(event:Event):void{
    	Object(this).popUpAnim_mc.gotoAndPlay("anim");
    	trace("anim");
    }
    I will be adding an 'if statement' to this code and control whether or not it plays or is static with information from an array. But I can't even get it to run just in a simple function. what am I overlooking??

    Thanks!

  2. #2
    Member
    Join Date
    Nov 2009
    Location
    Philadelphia
    Posts
    41
    Why is it in an onEnterFrame? depending on your frame rate you're calling the "gotoAndPlay" 24 times/second.... so you keep going back to the initial frame "anim"
    What exactly are you trying to accomplish when you say
    trying to control a popup textbox with AS
    ?
    - Nick Stanziani

    pls support: www.whowantsacookie.com

    My site: pebcak

  3. #3
    Member
    Join Date
    Jun 2003
    Location
    sunny SoCal
    Posts
    76
    What else could I use instead of EnterFrame? I'm trying to figure out how to trigger an event or even change a variable's value on each frame of the main timeline.

    I'm trying to use an array to set yes or no values (I tried a boolean, but that didn't seem to work either) for different frame numbers (of the main timeline), and control which frames the pop up box slides in from offscreen, and which it remains in place as the user clicks through a simple slideshow. For example, if there are four slides (four frames of the main timeline) and I want the popup box to slide in for the first frame and the last frame, but to stay static for the second and third frames.

    I don't even know if I am explaining what I need correctly. :\

  4. #4
    :
    Join Date
    Dec 2002
    Posts
    3,514
    Code:
    import fl.transitions.*;
    import fl.transitions.easing.*;
    import flash.events.Event;
    
    var myTween:Tween = new Tween(PopUp_mc,"y",Strong.easeOut,PopUp_mc.y,300,1,true);
    var lastFrame:int = -1;
    addEventListener(Event.ENTER_FRAME, upDate);
    
    function upDate(e:Event):void {
            if (lastFrame != currentFrame) {
                    lastFrame = currentFrame;
                    trace("The frame has changed to " + currentFrame);
                    if (currentFrame == 1 || currentFrame == 4) {
                            new Tween(PopUp_mc,"y",Strong.easeOut,PopUp_mc.y,300,1,true);
                    } else {
                            new Tween(PopUp_mc,"y",Strong.easeOut,PopUp_mc.y,500,1,true);
                    }
            }
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width


HTML5 Development Center

Poll by Flashkit.com