|
-
AS3 animation problem
uhm... My animation was made by using AS3 to create a kind of 3d DNA on scene 2 as my secondary intro... The problem was that once it reached scene 3
the whole scene 2 was sent at the back of scene 3 so the DNA animation could still be seen on the whole stage of scene 3...
could anyone help me? i've been having a problem figuring this out...
Here's my file if you need to visually see it...
http://www.mediafire.com/?33uwcr91avbtppm
-
Be more specific. What is it doing, and what do you want it to be doing? Are you getting errors? Post any relevant code.
-
I want to hide or even remove the whole animation after the last frame of stage 2
so that it doesn't show up during the animation of stage 3.
this is the code for the dna animation that would continue on to the next scene...
Actionscript Code:
var position:Number = 50; var rot:Number = 170; addEventListener(Event.ENTER_FRAME, onEnterFrame); function onEnterFrame(event:Event):void { var o:dna = new dna(); o.x += position; o.y += position; o.rotation = rot; addChild(o); position++; rot++; } var secs:Timer = new Timer(1000, 15); secs.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete); secs.start(); function onTimerComplete(event:TimerEvent):void{ removeEventListener(Event.ENTER_FRAME, onEnterFrame); }
-
stage...
uhm scene 1 to 3 when played together stacks up on each other...
is there a way to prevent them from stacking up? since they block other parts of the animation...
scene 1 after last frame ends enters scene 2 where in scene 2 just goes over scene 1 in the stage...
-
I've never used scenes (and barely used frames) so I'm not really the guy to ask about animation questions. But I believe that content you add through script (with addChild) will remain on the display through frame and scene changes. You need to explicitly remove it with removeChild.
To do so, keep references to the things you've added in an array so that you can iterate over that array later and remove them all.
-
sorry for the question... how would i transfer my codes to be a mc for me to make it possible to set it as a value in an array?
Actionscript Code:
var position:Number = 50; var rot:Number = 170; addEventListener(Event.ENTER_FRAME, onEnterFrame); function onEnterFrame(event:Event):void { var o:dna = new dna(); o.x += position; o.y += position; o.rotation = rot; addChild(o); position++; rot++; } var secs:Timer = new Timer(1000, 15); secs.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete); secs.start(); function onTimerComplete(event:TimerEvent):void{ removeEventListener(Event.ENTER_FRAME, onEnterFrame); }
-
how would i transfer my codes to be a mc for me to make it possible to set it as a value in an array?
I have no idea what this means. But to put your dna instances in an array is just like putting anything else in an array.
Code:
var dnas:Array = [];
var position:Number = 50;
var rot:Number = 170;
addEventListener(Event.ENTER_FRAME, onEnterFrame);
function onEnterFrame(event:Event):void {
var o:dna = new dna();
o.x += position;
o.y += position;
o.rotation = rot;
addChild(o);
dnas.push(o);
position++;
rot++;
}
var secs:Timer = new Timer(15000, 1);
secs.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
secs.start();
function onTimerComplete(event:TimerEvent):void{
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
while(dnas.length > 0){
removeChild(dnas.pop());
}
}
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|