Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Animated symbol inside a button?

Status
Not open for further replies.

endoflux

Technical User
Aug 6, 2001
227
US
So I'm trying to get this button to animate (it's supposed to rotate 90 degrees when clicked on) when clicked on inside a flash movie...I've done up the animation inside a symbol, and nested the symbol inside a button, placing it in the "hit" state. However, when i publish it, the button only rotates when I'm holding the mouse button down on it; it will begin rotating until I let go, at which point it snaps back up into place. How can I get it to follow through it's entire animation and stop at the end of it just by clicking once??
 
I have a CRUDE one done oldnewbie...2 'doors' which close each other...I think I should have an actionscript in there looping to check MC's in the movie which are duplicates of this one, and do the script, but as of now, MC1 checks MC2 when pressed, and MC2 checks MC1 when pressed, and if either of them are open, it closes the other one, then opens itself...

I named it sheesh because it was a big hastle...lol

Anyone know where I could get an account REALLY fast?...I'm at work and would like to upload it so you all could see...

Also, is there any way of making array's of MC's? Regards,
Anth:cool:ny
----------------------------------------
"You say [red]insanity[/red] like it's a BAD THING!"
 
Thank you! You're both wonderful people. I'm going to work on this a while...wish me luck!

No idea about arrays...I have ltos to learn yet :)
 
reason asking about arrays of MC's is because I want to do a loop and have it get MC(1) or so and ahve it advance so I can get some actionscript together and make it all work fancy...=P Regards,
Anth:cool:ny
----------------------------------------
"You say [red]insanity[/red] like it's a BAD THING!"
 
Try or
mywink.gif
ldnewbie
 
Prohosting never lets anyone else look at my stuff, I would suggest NOT using that one actually...=) Regards,
Anth:cool:ny
----------------------------------------
"You say [red]insanity[/red] like it's a BAD THING!"
 
Old--

I don't really understand what makes the button link to the clip, make it start, stop, etc...what I see is a button that's simply a clickable area with no actions, and a clip not connected to it at all with some actions in it I don't entirely understand; it looks like you're setting visability on something?

It functions great...but I can't figure out how! :)
 
Crap, no new signups on F2s...
and Prohosting never lets anyone see what I post there!...GRRR!!!!!!!!!!!

Anyone else know of a place I can post it to?...can't email cuz thats logged. ='( Regards,
Anth:cool:ny
----------------------------------------
"You say [red]insanity[/red] like it's a BAD THING!"
 
Endo,
The invisible button is inside holder1 mc. Double click this mc, you'll now be in edit mode of the mc... Up there, you'll have Scene1 holder1.
Right-click on the button (the only thing in this mc), and select actions from the popup menu! That's were the actionscript is!
The other actions are in the door1 mc!
mywink.gif
ldnewbie
 
I see!!

However, when I go to write this code in my movie, the action "on" is greyed out, while all the others are useable...any idea why it doesn't want me to use that specific one??
 
The only use of the on action is with a button! In this case, even if the movie clip appears to be a button, it is not! It just so happens that it only contains a button, where the confusion! To set the actions of that button, you have to be in the edit mode of the holder1 mc, and select the button itself.

In your .fla, at least in the one you sent me, you add a button on stage, not a mc, and in the down state of your button you had your animation. That's why it only worked when you kept the mouse pressed.
I don't have a button on stage! I have a mc that contains a button. You wouldn't even see it, if I had'nt put an alpha on the up state of the button. It's supposed to be an invisible button in an invisible mc! The illusion of seeing the button is created by the actual animation clip that's lying under this invisible mc on a below layer, waiting to play when the invisible button is hit!
Get it?

Patience of a saint!... As Dave once put it!
mywink.gif
ldnewbie
 
yes...I spent some time re-analyzing what you did with buttons and whatnot; it makes sense! Thanks for helping...

One easy question I had...you may have noticed that I used a million motion tweens to keep the corner of my button in the right sport while swinging...you have jsut two tweens; one for up, one for down. Can I ask--how did you keep it on track??
 
Hey, WhiteTiger - arrays of MCs aren't a problem. Actually they are but you can fake them really easily ;-)

Here's how to create a pseudo array...

Let's say we have an MC - "exampleClip". If I want to create multiple versions I'd just drag them to the stage from the library and give them the instance names exampleClip1, exampleClip2 etc.

To address them easily I'd use something like the following script which assigns each instance (up to whatever maximum number you like, I've left it as a variable) a random transparency value....(just attach the script to one of the clips on the stage)

onClipEvent(load){
for(i=1;i<maxNumber;i++){
eval(&quot;_root.exampleClip&quot;+i)._alpha=int(math.random()*100);
}
}


you can also use square bracket syntax to identify the clip - I've used eval here because it's easier to see what's going on: it adds together all of the elements in the parentheses into one string and then evaluates that string as an instance.

If you bring in actions such as duplicateMovieClip() into the mix you can create pseudo-arrays on the fly, but best to get the basic idea together first....
 
endoflux, go to modify, transform and edit center...note that it has to be a symbol tho...then rotate it...=) Regards,
Anth:cool:ny
----------------------------------------
&quot;You say [red]insanity[/red] like it's a BAD THING!&quot;
 
Thanks! I actually played with it a bit before I left work last night and got it working...the two problems I had from my original movie were

1: I had a button in the stage, not a MC...so it wouldn't play unless I had the mouse button down over it. This was fixed by putting a blank button (I used a box with a white fill and got rid of the border) inside a symbol, with instructions to start a movie clip when pressed. I placed the symbol on the stage under the animated movie clip, and that worked fine.

2: I couldn't get the button to link to my MC correctly; it just wasn't animating. By Previewing it in &quot;Flash&quot; mode, it gave me errors pointing out that it couldn't make the link between them, and I realized I hadn't NAMED my instances. After I named my instances accordingly, it worked beautifully!

Thanks to everyone who helped on this; I'm just learning here, and really appreciate the mentoring!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top