i am new to flash. got a jpeg on frame 1 that i made into a symbo, would like to use this as a button. when clicked i would like the play hea to go to frame 2 where i have my flv movie this file would play (it's a quicktime movie that was imprted into flash. What kind of scripts would i need and where would they go?
Re: button (AS3 response) by demetri tashie on Apr 17, 2009 at 12:08:56 am
this code is written in AS3 ...
Establish frame 1: on frame one you have a symbol( either a Button Symbol or a MovieClip symbol) on the stage. give it an instance name of "myBtn". add this code on frame 1:
function myFunction(evt:MouseEvent):void{
gotoAndStop(2);
}
you indicate you are importing a QuickTime .mov as opposed to a .flv i assumed you were just playing a flv. are you using CS3 or CS4? They both handle importing QuickTime differently. make sure you know how you are importing a QuickTime, and what you are doing with it ( i.e are you embedding it frame by frame so you can animate on top of it ? or what ). If you don't understand that part of it, go and view the tuorials on Flash and Video. you do not give enough information to be more specific. but - if you are just having a video player on frame 2, the above code is just fine. if you have embedded a video frame by frame ( not recommended necessarily ...), then you should change the code from gotoAndStop to gotoAndPlay
Re: button (AS3 response) by johnsabbath d'urzo on Apr 17, 2009 at 11:40:10 am
i am using Cs3. I put the flv on frame 2 and used your code on frame 1, this worked very well thank you. would it be posable when the user rollover frame 1 something happens to the btn. just need something simple maybe a blur or the image turns black and white. is this posable to do within flash?
Re: button by demetri tashie on Apr 17, 2009 at 1:27:37 pm
yes of course you can do that - that is some of the original functions of Flash, from way back when ...
i suggest you review some of the basic tutorials on basic animating. for beginners, i would suggest turning your image into a Button Symbol, and animating its states that way.
however, if you substitute all of this code for your code in frame 1 , you will see that the button image dims on RollOver(MouseOver) to 50% , then on RollOut(MouseOut) it returns to normal. you could of course change those valuse to whatever, or reverse them, or use different attributes rather than alpha.
i wrote the code so that it should be easy for you to read, understand, and adjust to your needs.
Re: button by demetri tashie on Apr 17, 2009 at 4:07:15 pm
if you made the image into a Button Symbol, then you do NOT need the extra code that i gave. go back to the original code and it should be fine. the other code was script that lets a MovieClip symbol change appearance. go back to:
i went back to the original code but i like what you did with the 50% image on the roll over. how do i do this, i have been doing some reading on what you mentioned on the "over state" can't find anything on editing that image. would i have to do this in photoshop or would i be able to edit the jpeg in flash? thanks for all this your a big help.
Re: button by demetri tashie on Apr 17, 2009 at 4:50:44 pm
if you like the 50% alpha , then go back to the longer code, which incorporates all of that.
look-first think of it this way: a Button Symbol is really a specialized type of Movie Clip that has code written into it ( that you don't see ... ) that tells it what to do upon the 4 Mouse States ( Up, Over, Down, and Hit ). you can choose to change any state you want to.
you also have the ability to write code to change a MovieCLip ( or Button's) staes, as i showed in the longer code.
IF you are using a Button symbol, and have those state changes within the Button Symbol, AND you have some additional code to change the states, then the code will work in addition to ( additive to ) whatever the Button Symbol's internal state change is. it might interfere with each other, or it might give you unintended results.
just think it through....
if your Button Symbol's UP state is Red, and you make its Over state to be Black, and then you add code to make the MOUSE_OVER state to be 50% alpha, well then upon a mouse over, the BUtton tells it to be Black, and then the code tells it to be 50% alpha, so it ends up being 50% Black ( Gray ).
that's fine, it is just usually easier to do it either all within the Button, or all in Code.
so. all that being said - i didn't really address your question, which is NO, you don't have to re-edit the original image if all you want to do is change its properties ( alpha, rotation, scale, etc ) Actionscript does that just fine - better.
of course button states can swap images out ( you can do this in code too) in which case you would need a different image ( either new, or edited) . any of the great tutorials on this site can show you how to do that.