Skip to main content
Participating Frequently
June 12, 2015
Answered

How to have 2 enter_frame functions happening in the one frame? I have a scene where I have an animated movie moving across the scene and I also want to have a custom cursor also enter the scene on the same frame.

  • June 12, 2015
  • 1 reply
  • 661 views

var mc_Dog1:WagDog = new WagDog();

addChild(mc_Dog1);

//mc_Dog1.x = 50; I have this in my ENTER_FRAME event handler)

mc_Dog1.y = 20;

mc_Dog1.width = 140;

mc_Dog1.height = 120;

addEventListener(Event.ENTER_FRAME, dogMove);

    function dogMove(event:Event):void

{

        if (mc_Dog1.x < (stage.stageWidth+25)) {

        mc_Dog1.x += 2;

        //myCursor.mouseEnabled=false; The commented custom cursor is also a movie clip, I need this format as in my animated quiz I am also using drag and drop)

        //Mouse.hide();

        //myCursor.x = root.mouseX;

   

        //myCursor.y = root.mouseY;

        }else{

        mc_Dog1.x = -25;

                 }

   }

This topic has been closed for replies.
Correct answer kglad

you can use one or two enterframe listeners.  eg,

a) 1 listener

this.addEventListener(Event.ENTER_FRAME,f)

function f(e:Event):void{

f1();

f2();

}

b) 2 listeners

this.addEventListener(Event.ENTER_FRAME,f1);

this.addEventListener(Event.ENTER_FRAME,f2)

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
June 12, 2015

you can use one or two enterframe listeners.  eg,

a) 1 listener

this.addEventListener(Event.ENTER_FRAME,f)

function f(e:Event):void{

f1();

f2();

}

b) 2 listeners

this.addEventListener(Event.ENTER_FRAME,f1);

this.addEventListener(Event.ENTER_FRAME,f2)

Participating Frequently
June 13, 2015

okay cool I will try this out, thank you for your prompt reply.

I am so near the end of my assignment, just need this and a couple of other things to work and it's finished.

Cheers

kglad
Community Expert
Community Expert
June 13, 2015

you're welcome.