Jump to content

Welcome to The OFFICIAL Pure Pwnage forums
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. If you already have an account, login here - otherwise create an account for free today!
Photo

Flash (action Script 3) Help

- - - - -

  • Please log in to reply
15 replies to this topic

#1
MC Hairmaster

MC Hairmaster
  • GA Private
  • 199 posts
  • xfire:bluken
  • Gender:Male
  • Location:London, England
  • Xbox / GFWL:MC Hairmaster
  • PSN:Want one...
  • Gamer Army ID:3759
I've just started learning the basics of flash and action script. It all goes fairly well but i have this one newby problem... My movie clip/animation thing plays on mouse scroll over and scroll out, works fine, but if you scroll over too many times too quickly it will just break and jump to certain frames. Anyone got any ideas?

#2
Jengerer

Jengerer

    2009 Softest Hair Winner & Best Staff

  • Retired Staff
  • 3,243 posts
  • xfire:Jengerer
  • Gender:Male
  • Location:Toronto, Ontario
  • Interests:Video games. Who knew?
  • Steam ID:Jengerer
  • Rofl-Rupees:2
  • Gamer Army ID:4485
Some code might help. Looks like you're triggering 'go-to-and-play' on roll over and out, so it's just skipping around when you do so.

#3
way2lazy2care

way2lazy2care
  • Members
  • 10,808 posts
  • Xbox / GFWL:way2lazy2care
  • PSN:A1R5N1P3R
QUOTE (MC Hairmaster @ Apr 30 2010, 07:42 PM) <{POST_SNAPBACK}>
I've just started learning the basics of flash and action script. It all goes fairly well but i have this one newby problem... My movie clip/animation thing plays on mouse scroll over and scroll out, works fine, but if you scroll over too many times too quickly it will just break and jump to certain frames. Anyone got any ideas?

a little bit more explanation would be nice too.
SPAMBOTSTOOKOVERMYSITE D:
Give me LoL Referals.

QUOTE (Virus52 @ Mar 3 2008, 09:44 AM) <{POST_SNAPBACK}>
ALL HAIL THE GREAT AND MIGHTY MOTH!

QUOTE (SN3S @ May 6 2008, 08:27 AM) <{POST_SNAPBACK}>
No sensuality; this is all for fitness.

#4
Lint

Lint
  • Members
  • 144 posts
  • Location:Canada
A quick fix would be just to put a wait somewhere so it only moves frames x times a second at a maximum.

#5
MC Hairmaster

MC Hairmaster
  • GA Private
  • 199 posts
  • xfire:bluken
  • Gender:Male
  • Location:London, England
  • Xbox / GFWL:MC Hairmaster
  • PSN:Want one...
  • Gamer Army ID:3759
yeah of course you want code, thought it mightve been a nooby mistake everyone makes..

stop();
import flash.events.MouseEvent;

function hidebutton(event:MouseEvent):void{
center.visible=false;
}
//-- FOR TOP BUTTON --\\
function flipaon(event:MouseEvent):void{
top.gotoAndPlay(1);

}


function flipaoff(event:MouseEvent):void{
top.gotoAndPlay(20);

}

center.addEventListener(MouseEvent.ROLL_OVER, flipaon);
center.addEventListener(MouseEvent.ROLL_OUT, flipaoff);

//--FOR LR BUTTON--\\
function flipbon(event:MouseEvent):void{
botl.gotoAndPlay(1);

}


function flipboff(event:MouseEvent):void{
botl.gotoAndPlay(20);

}

center.addEventListener(MouseEvent.ROLL_OVER, flipbon);
center.addEventListener(MouseEvent.ROLL_OUT, flipboff);

//--FOR RR BUTTON --\\


function flipcon(event:MouseEvent):void{
botr.gotoAndPlay(1);

}


function flipcoff(event:MouseEvent):void{
botr.gotoAndPlay(20);

}

center.addEventListener(MouseEvent.ROLL_OVER, flipcon);
center.addEventListener(MouseEvent.ROLL_OUT, flipcoff);



#6
way2lazy2care

way2lazy2care
  • Members
  • 10,808 posts
  • Xbox / GFWL:way2lazy2care
  • PSN:A1R5N1P3R
QUOTE (MC Hairmaster @ May 1 2010, 04:41 AM) <{POST_SNAPBACK}>
yeah of course you want code, thought it mightve been a nooby mistake everyone makes..

stop();
import flash.events.MouseEvent;

function hidebutton(event:MouseEvent):void{
center.visible=false;
}
//-- FOR TOP BUTTON --\\
function flipaon(event:MouseEvent):void{
top.gotoAndPlay(1);

}


function flipaoff(event:MouseEvent):void{
top.gotoAndPlay(20);

}

center.addEventListener(MouseEvent.ROLL_OVER, flipaon);
center.addEventListener(MouseEvent.ROLL_OUT, flipaoff);

//--FOR LR BUTTON--\\
function flipbon(event:MouseEvent):void{
botl.gotoAndPlay(1);

}


function flipboff(event:MouseEvent):void{
botl.gotoAndPlay(20);

}

center.addEventListener(MouseEvent.ROLL_OVER, flipbon);
center.addEventListener(MouseEvent.ROLL_OUT, flipboff);

//--FOR RR BUTTON --\\


function flipcon(event:MouseEvent):void{
botr.gotoAndPlay(1);

}


function flipcoff(event:MouseEvent):void{
botr.gotoAndPlay(20);

}

center.addEventListener(MouseEvent.ROLL_OVER, flipcon);
center.addEventListener(MouseEvent.ROLL_OUT, flipcoff);


I still don't understand what the problem actually is. Like when you scroll over rapidly it will jump to frame 5 or something?

SPAMBOTSTOOKOVERMYSITE D:
Give me LoL Referals.

QUOTE (Virus52 @ Mar 3 2008, 09:44 AM) <{POST_SNAPBACK}>
ALL HAIL THE GREAT AND MIGHTY MOTH!

QUOTE (SN3S @ May 6 2008, 08:27 AM) <{POST_SNAPBACK}>
No sensuality; this is all for fitness.

#7
MC Hairmaster

MC Hairmaster
  • GA Private
  • 199 posts
  • xfire:bluken
  • Gender:Male
  • Location:London, England
  • Xbox / GFWL:MC Hairmaster
  • PSN:Want one...
  • Gamer Army ID:3759
sorry, basically if you scroll over the movie whilst it is in animation too quickly or rapidly, it will only jump to the beginning and end frames which are also in the wrong order

#8
way2lazy2care

way2lazy2care
  • Members
  • 10,808 posts
  • Xbox / GFWL:way2lazy2care
  • PSN:A1R5N1P3R
QUOTE (MC Hairmaster @ May 2 2010, 02:39 PM) <{POST_SNAPBACK}>
sorry, basically if you scroll over the movie whilst it is in animation too quickly or rapidly, it will only jump to the beginning and end frames which are also in the wrong order

ok so let's say your animation has n frames where n>20 so 1, 2, 3, .. , 20, .. , n

the "beginning frames" would be 1? or 1 and 20? and end frames would be 19 and n? Are you scripting in the "actions" window or in a separate file?

The way you have it set right now, all your event listeners are on the same object, so anytime you roll over that it will start all of them. There also isn't anything that will stop it from playing in your code when you roll off, it'll just go to a different frame and loop back around to the start. Is that not what it's doing? if it is what it's doing, what do you want it to do more specifically?
SPAMBOTSTOOKOVERMYSITE D:
Give me LoL Referals.

QUOTE (Virus52 @ Mar 3 2008, 09:44 AM) <{POST_SNAPBACK}>
ALL HAIL THE GREAT AND MIGHTY MOTH!

QUOTE (SN3S @ May 6 2008, 08:27 AM) <{POST_SNAPBACK}>
No sensuality; this is all for fitness.

#9
MC Hairmaster

MC Hairmaster
  • GA Private
  • 199 posts
  • xfire:bluken
  • Gender:Male
  • Location:London, England
  • Xbox / GFWL:MC Hairmaster
  • PSN:Want one...
  • Gamer Army ID:3759
there are seperate stop(); commands within the seperate movie clip symbols, stopping it from looping. It just bugs from the first stop frame to the next one. Also...another question that has arisen, how can i make a symbol do something once another action has been triggered...say symbol 1 has triggered symbol 2 to rotate... then once that has happened i want symbol 2 to listen alongside symbol 1 so that if symbol 2 is highlighted, it will glow or some effect...

#10
way2lazy2care

way2lazy2care
  • Members
  • 10,808 posts
  • Xbox / GFWL:way2lazy2care
  • PSN:A1R5N1P3R
QUOTE (MC Hairmaster @ May 2 2010, 08:49 PM) <{POST_SNAPBACK}>
there are seperate stop(); commands within the seperate movie clip symbols, stopping it from looping. It just bugs from the first stop frame to the next one. Also...another question that has arisen, how can i make a symbol do something once another action has been triggered...say symbol 1 has triggered symbol 2 to rotate... then once that has happened i want symbol 2 to listen alongside symbol 1 so that if symbol 2 is highlighted, it will glow or some effect...

Well I'm guessing now that all your stuff takes place in the actions panel then. I'd recommend using external files in AS3 in the future.

anywoo. I'm still confused about your problem. So you have multiple stop frames (19 and n from my previous post) and it's jumping between 19 and n and back and forth repeatedly? is there a way you could host it somewhere so I can see what you mean? It's kind of hard to understand the way it's being described.

If you want a movieclip to trigger something else you can either create your own event by passing a function from symbol 2 to a function in symbol one as a parameter, or there's probably a good amount of movieclip events that could trigger it to happen for you. I don't know all of the movie clip events though. It boils down to when you want it triggered and finding the appropriate event for it.
SPAMBOTSTOOKOVERMYSITE D:
Give me LoL Referals.

QUOTE (Virus52 @ Mar 3 2008, 09:44 AM) <{POST_SNAPBACK}>
ALL HAIL THE GREAT AND MIGHTY MOTH!

QUOTE (SN3S @ May 6 2008, 08:27 AM) <{POST_SNAPBACK}>
No sensuality; this is all for fitness.

#11
MC Hairmaster

MC Hairmaster
  • GA Private
  • 199 posts
  • xfire:bluken
  • Gender:Male
  • Location:London, England
  • Xbox / GFWL:MC Hairmaster
  • PSN:Want one...
  • Gamer Army ID:3759
okay heres the .fla file, see what you make of it

http://www.mediafire.com/?2nu5wwzjnkr

edit: as ive been messing about with stuff you need to remove some code for it to work normally

Edited by MC Hairmaster, 03 May 2010 - 06:51 AM.


#12
way2lazy2care

way2lazy2care
  • Members
  • 10,808 posts
  • Xbox / GFWL:way2lazy2care
  • PSN:A1R5N1P3R
QUOTE (MC Hairmaster @ May 3 2010, 06:31 AM) <{POST_SNAPBACK}>
okay heres the .fla file, see what you make of it

http://www.mediafire.com/?2nu5wwzjnkr

edit: as ive been messing about with stuff you need to remove some code for it to work normally

I'll look at it and let you know in a bit icon_smile.gif

edit: is it in CS4? I have CS3 if you can upload it again with CS3 compatibility I can look at it. :-/

Edited by way2lazy2care, 03 May 2010 - 12:26 PM.

SPAMBOTSTOOKOVERMYSITE D:
Give me LoL Referals.

QUOTE (Virus52 @ Mar 3 2008, 09:44 AM) <{POST_SNAPBACK}>
ALL HAIL THE GREAT AND MIGHTY MOTH!

QUOTE (SN3S @ May 6 2008, 08:27 AM) <{POST_SNAPBACK}>
No sensuality; this is all for fitness.

#13
MC Hairmaster

MC Hairmaster
  • GA Private
  • 199 posts
  • xfire:bluken
  • Gender:Male
  • Location:London, England
  • Xbox / GFWL:MC Hairmaster
  • PSN:Want one...
  • Gamer Army ID:3759
http://www.mediafire.com/?yytje5zwgdw

CS3 version icon_smile.gif thanks

#14
way2lazy2care

way2lazy2care
  • Members
  • 10,808 posts
  • Xbox / GFWL:way2lazy2care
  • PSN:A1R5N1P3R
QUOTE (MC Hairmaster @ May 3 2010, 04:25 PM) <{POST_SNAPBACK}>

Ok I see a problem, let me just make sure this is the problem you're talking about. When you scroll over the gray things they flash back and forth between their upside down and normal versions.

This is what you need fixed yes?

Ok, this is what it seems your problem is. in your movie clips you have the stop() calls on the opening frames, and then on every frame following. You want to make an keyframe on the rest frame that has the stop, but not on every frame leading up to it or you're essentially calling gotoAndPlay(1); stop(); and it isn't doing anything.

Will edit this post as I find more stuff.
SPAMBOTSTOOKOVERMYSITE D:
Give me LoL Referals.

QUOTE (Virus52 @ Mar 3 2008, 09:44 AM) <{POST_SNAPBACK}>
ALL HAIL THE GREAT AND MIGHTY MOTH!

QUOTE (SN3S @ May 6 2008, 08:27 AM) <{POST_SNAPBACK}>
No sensuality; this is all for fitness.

#15
MC Hairmaster

MC Hairmaster
  • GA Private
  • 199 posts
  • xfire:bluken
  • Gender:Male
  • Location:London, England
  • Xbox / GFWL:MC Hairmaster
  • PSN:Want one...
  • Gamer Army ID:3759
i still dont really understand where exactly i need to change and what, i sort of see what you're saying, but dont understand why it works fine unless you scroll over rapidly.

#16
way2lazy2care

way2lazy2care
  • Members
  • 10,808 posts
  • Xbox / GFWL:way2lazy2care
  • PSN:A1R5N1P3R
QUOTE (MC Hairmaster @ May 4 2010, 10:13 AM) <{POST_SNAPBACK}>
i still dont really understand where exactly i need to change and what, i sort of see what you're saying, but dont understand why it works fine unless you scroll over rapidly.

it did not work fine for me when I scrolled over normally. It flipped back and forth a lot (I'm pretty sure it has to do with stop() being on frame 1 of your code in the movieclips).

My fix, which made it get closer to working. Go into one of the buttons (I went into top). open the first frame of your code layer, and for me it contains stop(). That means when you call gotoAndPlay(1), it will call stop() right away. You want to insert a keyframe at your end frame of each animation (forgot the number) and call stop() there. I think when I did that I ended up having to add 1 or 2 frames to the actual animation to make it look right.

I'll do that and see if I still run into your problem.

edit: OK! I think I see what the problem you're talking about is. I'm not sure if it got funky when you switched it to CS3 or if CS4 interprets it's actions pane differently, but it wasn't working right the normal way all the time for me. I made the fixes I told you about, and I think I'm getting your error now.

1. You had a box layer in your circle. What was this for? It was changing size throughout the animation, and that changes the size of the hit rectangle of the whole movieclip which made the different flip methods go back and forth really fast. (you scroll over a large hit-rect, which jumps to a frame with a smaller hit rectangle, which jumps to a frame with a big hit rectangle, etc).
2. If you're talking about it jumping between animations on rollover, there is no easy way around that the way you have it set up right now. You could do some more coding to have it play in forward or reverse to make the animation transition smoothly in either direction.

Flash, however, can't play backwards, so you'd have to use something that get's called every frame that goes gotoAndStop(currentFrame - 1) if it is playing backwards, which would be much easier in an external AS3 file :-X

double edit: if you PM me an email I can send you back the .fla with my changes.

Edited by way2lazy2care, 04 May 2010 - 11:14 AM.

SPAMBOTSTOOKOVERMYSITE D:
Give me LoL Referals.

QUOTE (Virus52 @ Mar 3 2008, 09:44 AM) <{POST_SNAPBACK}>
ALL HAIL THE GREAT AND MIGHTY MOTH!

QUOTE (SN3S @ May 6 2008, 08:27 AM) <{POST_SNAPBACK}>
No sensuality; this is all for fitness.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users