Go Back   CodingForums.com > :: Client side development > Flash & ActionScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-01-2011, 06:34 PM   PM User | #1
Bojan86
New to the CF scene

 
Join Date: Sep 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Bojan86 is an unknown quantity at this point
Question Need professional code hint ;)

OK, so I have an idea of making some cool 3D video transition, with one video on frame 1, and other on frame 2... There will be five of them, so I need my code to work.
Using all kinds of tutorials I came up with this code:
import caurina.transitions.*;


stop();

spin.addEventListener(MouseEvent.CLICK, cl);
var isTurning:Boolean = false;
function cl(e:Event):void
{
if(!isTurning)
{
Tweener.addTween(con, {rotationY:con.rotationY+180,
time:1, onComplete:function(){isTurning = false;}});
isTurning = true;

}

}

addEventListener(Event., loop);
function loop(e:Event):void
{
if(con.rotationY > 90 && con.rotationY < 270)
{
gotoAndStop("drugi");
}
else
{
con.addChild(con.vid);
}
}

in highlited part is where I got stuck... Which event should I use?

So, I want to click on button, video spins and goes to frame named "drugi", where another video is...
Bojan86 is offline   Reply With Quote
Old 09-09-2011, 02:13 AM   PM User | #2
MrConman
New Coder

 
Join Date: Aug 2011
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
MrConman is an unknown quantity at this point
if you're only wanting to call the function when you press the button, an event listener shouldn't be needed.... That is if you button is calling code when it is pressed.

If you simply remove the eventListener, and the e:Event it should work. The following code will call the function when loop(); is called. So if you wish to execute the loop function from the button code, place loop(); in the call.

Code:
loop();
Note the function isn't required to run from an eventListener.

Code:
function loop():void
{
if(con.rotationY > 90 && con.rotationY < 270)
{
gotoAndStop("drugi");
}
else
{
con.addChild(con.vid);
}
}
MrConman is offline   Reply With Quote
Old 09-09-2011, 05:02 AM   PM User | #3
Cammy
New Coder

 
Join Date: Aug 2011
Location: Gold Coast, Australia
Posts: 16
Thanks: 1
Thanked 1 Time in 1 Post
Cammy is an unknown quantity at this point
If you are looping it each frame you should use this code
Code:
 addEventListener(Event.ENTER_FRAME, loop)
Cammy is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:01 PM.


Advertisement
Log in to turn off these ads.