How-to
Creating a button to activate a movie clip
May 5th
first create a button on the area of the screen you want to activate, create a frame from up to hit.
enter the code:
buddha_btn.addEventListener(MouseEvent.CLICK,buddha_btnPressed);
function buddha_btnPressed(event:MouseEvent):void{
gotoAndStop(9);
};
Create a movie clip in the next frame (i made it in frame 9) be sure to name it (in my case i named it help_mc), next create the tweening or whatever you want to do in the clip and add the code:
stop();
MovieClip(parent).gotoAndStop(8);
Because at the end of the clip I wanted it to go back to the place where I started, I added the frame number “8″ to take it back to where I hit the button.
Button to call the next screen, with TWEENS!
May 5th
Ok, so this is the easier version of making slide transitions between screens.
Click on the escape ‘x’ which will take you to the next screen.
Place your frame that is “sliding in” on Layer 3. Tween from its starting position off screen to the right, to its ending position in the iPhone screen. (Make sure to create a mask)
On the labels layer place your current frame in the iPhone screen and tween from that position to its ending position off to the left.
Add an instance name to the screen on scene1 that is currently being used (nasdaq_screen)
The instance name for the button to proceed to the next screen here is called escape_btn.
Continue to place the button name (with capitalized first letter!) between the two “on______Click” actions.
Place a stop(); after your last frame to keep from looping.
stop();
nasdaq_screen.escape_btn.addEventListener (MouseEvent.CLICK, onEscapeClick);
function onEscapeClick (event:MouseEvent) : void {
this.play();
}
How to click a movie clip to call out another movie clip
May 5th
With much needed help from Amber, my greatest accomplishment of the flash video (that wasn’t even featured in my presentation
) is here.
The Flash plugin is required to view this object.
To view the action click the blue tab located in the top right corner of the screen (this is called companysort_mc)
When this is CLICKED the menu slides out (companysort_btn)
Embed the button inside of the movie clip, and the movie clip inside of the larger movie clip (the screen, called: companiesabc_mc)
Name the screen on Scene1 (compabc_screen)
Actionscript:
stop();
compabc_screen.companysort_mc.companysort_menu.addEventListener(MouseEvent.CLICK, moveout);
compabc_screen.companysort_mc.companysort_btn.addEventListener (MouseEvent.CLICK, onCompanysortClick);
function moveout (event:MouseEvent) : void {
compabc_screen.companysort_mc.play();
}
function onCompanysortClick (event:MouseEvent) : void {
this.play();
}
WHAM! BAM! THANK YOU MA’AM!
UNCONFIRMED RUMOR: Apple is upgrading all iPhones to iPad hardware.
May 5th
this is a how-to:
1. get a very sturdy rubberband, pref. one that holds broccoli together.
this can be found easily with the help of your local grocer.
2. all right. this is going to be tough, but you can do it.
stretch the rubberband over your head.
you must do this delicatley as any mishap could result in
you wearing an eyepatch all summer and being mistaken for a
pirate, and i know pirates were “cool” again last year, but you really
don’t want this, plus you are a grafiks designer and you need 2 eyes.
3. whilst stretching the broccoli rubberband, jam the magnifying glass that
you stole from eckerds/cvs/walgreens/your local retirement village/castle
over your eyes.
4. OUILA! SUPER AMAZING.
you have upgraded to iPad hardware.
5. CONGRATULATIONS.
-logan
switch how-to
May 5th
The Flash plugin is required to view this object.
i’m really proud of my switch. It was more animation than code.
1irst. i made 4 variations of the switch in illustrator, one with the switch pressed all the way down one without either pushed down, and then 2 steps in between “open” and “closed”
2econd. i set each variation in it’s own frame, one after another and kept the frame rate at 24 fps so it will appear like a fluid motion
3hird. i set an invisible button over the switch and made appropriate eventListeners etc. so that clicking on the switch would cause the animation to occur
4ourth. made sure to put stops in place so it wouldnt just loop forever.
i hope posting the .swf works.
How to # 2
May 5th
This could have been accomplished through an easier way but since Flash was being very sensitive, I had to choose this way. This can be used when you want to reveal a button once another button is pressed on and that revealed button would let you play the next frame.
The movie clip on scene 1 would have the stop action. Then inside the movie clip, the button that contains the other button as well will have this code:
carseat.check_gr.alpha = 0;carseat.info_btn.alpha = 0;
carseat.carseat_btn.addEventListener(MouseEvent.CLICK, onCarSeatClick);carseat.info_btn.addEventListener(MouseEvent.CLICK, onInfoClick);
function onCarSeatClick (event: MouseEvent) : void { carseat.play(); carseat.check_gr.alpha = 1; carseat.info_btn.alpha = 1;}
function onInfoClick (event: MouseEvent) : void { MovieClip (parent).play();}
Within this button, you would have the other button and a stop action for it.
Mas Tuts
May 5th
http://www.adobe.com/devnet/flash/
Is a page created by Adobe for the Flash developing community. Its got downloadables, tutorials, and developers contribute articles and such.
Button MovieClip
May 5th
Have your main screens on the main stage in seperate frames and want a button to animate before moving on to the next one? It’s easy!
Set up your button animations and programming like normal, but don’t tell it to move on in your regular code. Instead, insert this line of code on the last frame of your button animation:
MovieClip(this.parent).gotoAndPlay(#);
This’ll move on to the specified frame (replace # with the frame number) as soon as the clip is finished playing!
how to make a button invisible
May 4th
yeah yeah, you should know this… but I actually forgot. And I had to use it a ton in the application and it kept getting muddy.
1 make a square
2 right click and convert to symbol (make sure it is a btn)
3 in scene one, double click into the button
4 drag the highlighted box that is labeled “UP” into the box labeled “HIT” (now make sure that you are not copying the box instead you only want one box in the “HIT” stage)
5 when you move back into scene 1 make sure that your button is a shade of light blue
This is useful when you are putting buttons over images, or existing art that you want to make interactive, or make the button simply imvisible.
yeah!
how to click on and off (what i used on the grid)
May 4th
used in the application where you click on and off the square in the grid.
I have two layers, one for actions and one for my square button that has been made into an invisible button (named pixel)
then inside the button which holds this movie clip
I have 3 layers.. one for two stops, one that has the button on and off, and one that shows a black square for the on part of the button
the code that goes on scene one is..
pixel.btn.addEventListener(MouseEvent.CLICK, onpixelClick);function onpixelClick(event:MouseEvent):void { pixel.play(); }
the picture here represents the three layers inside the movie clip.. the bottom layer holds the black square in the second frame.
Click and Drag
May 4th
I used click and drag in my app. Here is a the coding I used:
line_one.addEventListener(MouseEvent.MOUSE_DOWN, dragOne);line_one.addEventListener(MouseEvent.MOUSE_UP, dropOne);line_two.addEventListener(MouseEvent.MOUSE_DOWN, dragTwo);line_two.addEventListener(MouseEvent.MOUSE_UP, dropTwo);line_four.addEventListener(MouseEvent.MOUSE_DOWN, dragFour);line_four.addEventListener(MouseEvent.MOUSE_UP, dropFour);bag_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragBag);bag_mc.addEventListener(MouseEvent.MOUSE_UP, dropBag);
//box_gray.addEventListener(Event.ENTER_FRAME, enterGray);bag_mc.addEventListener(Event.ENTER_FRAME, hit);
function dragOne (event:MouseEvent) : void { event.target.startDrag();}function dragTwo (event:MouseEvent) : void { event.target.startDrag();}function dragFour (event:MouseEvent) : void { event.target.startDrag();}
function dropOne (event:MouseEvent) : void { event.target.stopDrag();}
function dropTwo (event:MouseEvent) : void { event.target.stopDrag();}function dropFour (event:MouseEvent) : void { event.target.stopDrag();}function dragBag (event:MouseEvent) : void { event.target.startDrag();}
function dropBag (event:MouseEvent) : void { event.target.stopDrag(); }
function hit (event:Event) : void { if (bag_mc.hitTestObject(line_one)) { line_one.alpha = .0;}
bag_mc.addEventListener(Event.ENTER_FRAME, hit);
function hit (event:Event) : void { if (bag_mc.hitTestObject(line_two)) { line_two.alpha = .0; }
bag_mc.addEventListener(Event.ENTER_FRAME, hit);
function hit (event:Event) : void { if (bag_mc.hitTestObject(line_four)) { line_four.alpha = .0; }}}}
Booleans – Tracking Multiple Animations
May 4th
This bit of code is from my demo city website, where there was an animation for clicking each button that also corresponded with the button going off-screen. This meant two animations were playing at once, depending on which button is currently “up” and which is coming into play. To keep track of this… booleans!
Bringing a layered Photoshop file into Flash Catalyst for production.
May 4th
This is how you take a layered document you set up in Photoshop and manipulate it in Flash Catalyst. AWESOME technology!
An Intro to Flash Catalyst.
May 4th
This is the program I used to build my app and it can now be purchased from Adobe.
I HIGHLY recommend Flash Catalyst if you are not a big fan of coding!
How to get different outcomes by password (right or wrong)
May 3rd
This how-to is a bit more complex than the previous post. I am using an If/else statement to play different movie clips, while making other movie clips invisible. You may have to study this example and a few like it in order to make it fit your own project. This is one of many ways to do this:
land.landraw.password_mc.submitpassword_btn.addEventListener(MouseEvent.CLICK, testpass);
var textpass:String = new String();
function testpass(event:MouseEvent):void
{
textpass = land.landraw.password_mc.password.text;
if (textpass == “gadus”)
{
land.landraw.rightpassword.gotoAndPlay(2);
land.landraw.password_mc.alpha = 0;
land.landraw.penguinstill.alpha = 0;
}
else
{
land.landraw.wrongpassword.gotoAndPlay(2);
land.landraw.password_mc.alpha = 0;
land.landraw.penguinstill.alpha = 0;
}
}
land.landraw.rightcontinue.addEventListener (MouseEvent.CLICK, onRightcontinueClick);
function onRightcontinueClick (event: MouseEvent) : void {
land.landraw.rightpassword.gotoAndStop(1);
land.landraw.wrongpassword.gotoAndStop(1);
land.landraw.password_mc.alpha = 1;
land.landraw.penguinstill.alpha = 1;
}
How to go to the next frame at the end of a mc
May 3rd
This is very light on the coding, but was very useful for me. I used this in transitional frames.
For example… I have 3 frames on my timeline and I want the first one to be a button to take you to the second frame and the second frame would play a mc that takes you to the third frame… I coded the button to play the next frame. On frame 2 I had a mc… at the end of the timeline within the mc I put…
stop();
MovieClip(parent).nextFrame();
It will take you to the third frame on the main timeline. I used this to play transitions and it worked well. It is very easy to do. And if it was within another movie clip the coding would be:
MovieClip(parent.parent).nextFrame();
Rollover
May 2nd
This is from working on my single page website for my app: a rollover. We did this last semester in a demo with Amber too, so it may look familiar to some. This takes the rollover and whatever animation you assigned to it will play when you hover but reverse when you hover out, so it just doesn’t keep playing the whole time. You define an invisible button inside to be able to hover and play. Assign an instance name to the movie clip on the main stage. The [about.btn.addEventListener] accesses the button inside the about movie clip.
//PRESET
var rewind:Boolean = false;
//LISTENERS
about.addEventListener(Event.ENTER_FRAME, aboutReverseFrame);
about.btn.addEventListener(MouseEvent.ROLL_OVER,aboutOver);
about.btn.addEventListener(MouseEvent.ROLL_OUT,aboutOut);
//FUNCTIONS
function aboutReverseFrame(event:Event):void {
if(rewind == true){
about.prevFrame();
}
}
function aboutOver(event:MouseEvent):void {
about.play();
rewind = false;
}
function aboutOut(event:MouseEvent):void {
rewind = true;
}
Play Sound onClick
May 2nd
Here’s where you play a sound when a symbol is clicked. This is after you import a sound and Export it for Actionscript, defining a class name. Here the class name is play6. You define the instance name in the first bit (var snd6:play6. play6 references the class defined in exporting for AS. Then, adding the listener and variable, in the function say you want whatever you named the object to play.
//Listener
sentence_6.addEventListener(MouseEvent.CLICK, sentenceSix);
//Variable
var snd6:play6 = new play6();
//Function
function sentenceOne(event:MouseEvent):void{
snd6.play();
}
Scroll
May 2nd
This tut is for how to make a scrolling menu, like I did for my landing navigation. Basically, what you’re doing is defining a box that you can drag and drop in, defining the width to the width of the buttons and height, however tall you would like it to be taken. From there, embed various buttons or movie clips and define where they should go from there.
nav_buttons_mc.addEventListener(MouseEvent.MOUSE_UP, mouseRelease);
//Variables
//Here’s where you define the rectangle
var boundArea:Rectangle=new Rectangle(33, -155, 0, 1000);
//Functions
//Here you define the drag and drop itself. The second section [nav_buttons.mc.startDrag] is binding the dragging and dropping to the area defined in the Rectangle.
function mousePress(event:MouseEvent):void {
var item:MovieClip = MovieClip(event.target);
nav_buttons_mc.startDrag(false, boundArea );
}
function mouseRelease(event:MouseEvent):void {
var item:MovieClip = MovieClip(event.target);
nav_buttons_mc.stopDrag();
}


