Flash Action Help

  • hartzz
  • Novice
  • Novice
  • hartzz
  • Posts: 18

Post 3+ Months Ago

I am simply trying to write an action that advances the time line forward by 12 frames when a certain button is pressed. I have tried to use this, thinking it oughta work:

on (release) {

gotoAndPlay(_currentframe + 12);

}

But all this does is return the playhead to the first frame. I am new to coding, so I have no idea why this is not working.


If you reply with a code, could you please put the "12" in there so I can tell exactly where it goes?

Thanks...

Hartzz
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Tchuki
  • Mastermind
  • Mastermind
  • Tchuki
  • Posts: 1774
  • Loc: Edinburgh

Post 3+ Months Ago

Did you attempt to use the code I gave you, and if so what was its effect(s) ?

just incase not, here it is again, with your 12 added:

Code: [ Select ]
this.onEnterFrame = function(){
_global.X = _level0._currentframe;
};
  1. this.onEnterFrame = function(){
  2. _global.X = _level0._currentframe;
  3. };



Code: [ Select ]
on(release){
_level0.gotoAndStop(_global.X+12);
}
  1. on(release){
  2. _level0.gotoAndStop(_global.X+12);
  3. }
  • hartzz
  • Novice
  • Novice
  • hartzz
  • Posts: 18

Post 3+ Months Ago

I tried it, but I am confused about how to enter it. Do I use both codes? My script assist gave me an error when I placed them both in the action box.
  • Tchuki
  • Mastermind
  • Mastermind
  • Tchuki
  • Posts: 1774
  • Loc: Edinburgh

Post 3+ Months Ago

The first block of code goes on either a mc or frame.

The second block of code goes on your button.
  • hartzz
  • Novice
  • Novice
  • hartzz
  • Posts: 18

Post 3+ Months Ago

So I place the first code as an action on my "actions" layer, then the other code for the object? It accepts those codes but still doesn't work. The first frame on my timeline has a stop action so I placed your code on frame 2 then put a key frame at the end of the timeline on the actions layer. Sorry, I am very new to this but am desperate to learn this one action. It's for a court trial.
  • Tchuki
  • Mastermind
  • Mastermind
  • Tchuki
  • Posts: 1774
  • Loc: Edinburgh

Post 3+ Months Ago

What is the error message your being given ?

Also, the idea of getting the current frame and moving forward 12 frames from any position means that the frame found will be "random", would it not be a better idea to specifiy a frame so you know where your going to end up ?
  • hartzz
  • Novice
  • Novice
  • hartzz
  • Posts: 18

Post 3+ Months Ago

Random is fine. There are 2300 total frames and each frame repeats itself twelve times before moving on to the next unique frame. I'm not getting an error after doing it like I explained in my last reply, it just doesn't work.
  • northstjarna
  • Beginner
  • Beginner
  • northstjarna
  • Posts: 58
  • Loc: Chertsey, UK

Post 3+ Months Ago

the first code above posted goes on the frame. the second part goes on your button.
you probably have everything on the same layer so you need to seperate your artwork and actionscript onto seperate layers.

create a new layer with only one keyframe on frame one and enter this code

Code: [ Select ]

stop();

]this.onEnterFrame = function(){

_global.X = _level0._currentframe;

};
  1. stop();
  2. ]this.onEnterFrame = function(){
  3. _global.X = _level0._currentframe;
  4. };



then create another layer with just a keyframe ion and put your button on it. then use the code...

Code: [ Select ]

on(release){

_level0.gotoAndStop(_global.X+12);

}
  1. on(release){
  2. _level0.gotoAndStop(_global.X+12);
  3. }


I tested it with diferent tect on every 12th frame and it works.

Cheers

Andi
  • hartzz
  • Novice
  • Novice
  • hartzz
  • Posts: 18

Post 3+ Months Ago

I tried it as best as I could. It still does not work. Obviously I am doing something wrong. What are the chances you could send me a sample .fla with a working one. You can just put blank frames in it.

Send it to mockdata@aol.com.

Is that possible?
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

Is that the best you can do? :lol:
  • northstjarna
  • Beginner
  • Beginner
  • northstjarna
  • Posts: 58
  • Loc: Chertsey, UK

Post 3+ Months Ago

yep, I'll email it to you in @ lunchtime GMT
  • hartzz
  • Novice
  • Novice
  • hartzz
  • Posts: 18

Post 3+ Months Ago

I received my sample from Andi. It does indeed work exactly as it should. My problem was that I was expecting to see the playhead move whilst in the edit mode. The code does not cause the playhead to move on the timeline. It does move during playback of the movie, which is the goal.

Thanks Andi.
  • northstjarna
  • Beginner
  • Beginner
  • northstjarna
  • Posts: 58
  • Loc: Chertsey, UK

Post 3+ Months Ago

Hi There,

when testing movie, go view, bandwidth profiler. It will show you the timeline in there.

If you want to see a timeline in the movie when published you will need to build one.

Thanks

Andi

Post Information

  • Total Posts in this topic: 13 posts
  • Users browsing this forum: No registered users and 8 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
 
 

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