HELP!

  • mike555
  • Newbie
  • Newbie
  • mike555
  • Posts: 6

Post 3+ Months Ago

I am new to ActionScript and wondered if it is possible to do something that i have been trying. What i want to do is get an animation running (shape tweeding) and when it gets to a point i can press a button and it moves onto the next scene. I can't see why it is not possible and think i have my coding wrong (I am just using the macromeida help on the side of actionscript to piece something together!)

Can anybody please give me the code or hints, or even better let me know if it is possible to start with!

Thanks.

Mike
  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Posts: 2733
  • Loc: Nashville, TN

Post 3+ Months Ago

Using AS2.0, you need to utilize the onMotionChanged event to test for a certain value & do something once that value has been reached.
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

i don't think he went so far in AS2.0, to use mx.transitions. See in his post: "I am new to ActionScript"
He merely wants a button on the stage with on(press).
Well, in this case, assuming you have a layer with the shape tween, create a new layer above it, place your button in a keyframe where you want it to appear, and place this code on it:
Code: [ Select ]
on(press)
{
  gotoAndPlay("Scene2", 1);
}
  1. on(press)
  2. {
  3.   gotoAndPlay("Scene2", 1);
  4. }
  • mike555
  • Newbie
  • Newbie
  • mike555
  • Posts: 6

Post 3+ Months Ago

Thanks for all the help, but would it be possible not for a button on screen, but pressing of the down button, or enter key, etc...

Would the code be on the last frame and something like

on(down)

{

gotoAndPlay("Scene2", 1);

}


***Total guess, like I say I am new to ActionScript so have not got a clue!***
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

yes, add a listener to the keybord.
put this code in a keyframe in the timeline, where you want to enable this behaviour.
Code: [ Select ]
var objListener:Object = new Object();
Key.addListener(objListener);
objListener.onKeyDown = function()
{
  if (Key.isDown(Key.Down))
 {
    gotoAndPlay("Scene2", 1);
 }
}
  1. var objListener:Object = new Object();
  2. Key.addListener(objListener);
  3. objListener.onKeyDown = function()
  4. {
  5.   if (Key.isDown(Key.Down))
  6.  {
  7.     gotoAndPlay("Scene2", 1);
  8.  }
  9. }

For this to work, the flash need to have the focus (meaning mouse press once on the flash in the
browser).

Or:
Code: [ Select ]
on(keyPress "<Enter>")
{
gotoAndPlay("Scene2", 1);
}
  1. on(keyPress "<Enter>")
  2. {
  3. gotoAndPlay("Scene2", 1);
  4. }

not sure for this if the button has to be focuse or just the stage

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 14 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.