I have never done Action Script 3 before, and never done Actionscript 2 from scratch. So definitely know that I may have went the long way in accomplishing what I was trying to do.
To expand my knowledge and to make sure I am going about things the right way, I am curious if anyone can take a look at my file and advise on either how I could have made the existing code better or a different route I should have taken to accomplish the same.
Basically, even though what I did accomplished what I was trying to do… I would like to know the more proper methods for future reference.
Attached is my fla file and the swf file.
Thank you in advance for any and all replies and feedback.
I figure I should add my action script here in case no one wants to download my fla lol.
Flash Information:
I have 3 movieclip symbols acting as buttons.
Only two movieclips are clickable at any given time.
Two movie clips appear as thumbnails with the third movieclip enlarged. Clicking any of the thumbnails causes it to switch places with the enlarged one.
Issues, aside from what in posted in my original post:
When hovering over a clickable movie click the mouse cursor doesn’t turn into a pointer like it does when you hover over a link or a button.
The movie clips, when one is enlarged … I want to have the content inside of it scrollable. I will be placing a table in there with static data… Not sure how to accomplish this or where to start.
The animation is alittle jagged on the edges instead of looking smooth.
Here is the code I am using:
//Default Active Image
var ActiveImage:Number=1;
//Detect Button clicks
this.Image2_mc.addEventListener(MouseEvent.CLICK, ImageClick);
this.Image3_mc.addEventListener(MouseEvent.CLICK, ImageClick);
//Function on button clicks + Enable-Disable Buttons
function ImageClick(event:MouseEvent):void {
switch (event.currentTarget) {
case Image1_mc :
if (this.ActiveImage==3) {
gotoAndPlay("Switch Image 3-1");
} else {
gotoAndPlay('Switch Image 2-1');
}
this.ActiveImage=1;
this.Image1_mc.removeEventListener(MouseEvent.CLICK, ImageClick);
this.Image2_mc.addEventListener(MouseEvent.CLICK, ImageClick);
this.Image3_mc.addEventListener(MouseEvent.CLICK, ImageClick);
break;
case Image2_mc :
if (ActiveImage==3) {
gotoAndPlay('Rotate Left');
} else {
gotoAndPlay('Switch Image 1-2');
}
this.ActiveImage=2;
this.Image1_mc.addEventListener(MouseEvent.CLICK, ImageClick);
this.Image2_mc.removeEventListener(MouseEvent.CLICK, ImageClick);
this.Image3_mc.addEventListener(MouseEvent.CLICK, ImageClick);
break;
case Image3_mc :
if (ActiveImage==2) {
gotoAndPlay('Rotate Right');
} else {
gotoAndPlay('Switch Image 1-3');
}
this.ActiveImage=3;
this.Image1_mc.addEventListener(MouseEvent.CLICK, ImageClick);
this.Image2_mc.addEventListener(MouseEvent.CLICK, ImageClick);
this.Image3_mc.removeEventListener(MouseEvent.CLICK, ImageClick);
break;
default :
trace('Something is wrong');
}
}
I would really love to know the proper way to do what I did, so I can do it correctly and more efficiently in the future.
Quick question, the method I too enabling and disabling the click event listener for the buttons, do you think there as a more efficient way of doing that?.. and what is your opinion on my code… am I heading in the correct direction, or do I need to improve my code and methods… Just want to make sure I learn the best and most effective coding practices.