|
|
|
|
Thread title: Flash Problems With ActionScript |
|
|
|
|
|
Thread tools
Search this thread
Display Modes
|
|
02-24-2008, 05:57 PM
|
#1
|
Status: Junior Member
Join date: Mar 2007
Location: North Carolina
Expertise: Photography
Software:
Posts: 73
|
Flash Problems With ActionScript
I'm currently building a game with pictures. The idea is to choose the right picture when the corresponding word appears. Here's a .swf version of the game:
http://masonsklut.com/olpc/
The problem I'm having is getting the "check-marks" to appear on the image when the image is selected. Instead Flash puts the check-mark in the next frame.
This is the ActionScript used to make the check-marks appear:
Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
wrong1_btn.onRelease = function () {
new Tween(wrong3_mc,"_alpha",Regular.easeOut,0,100,12,false);
new Tween(wrong3_mc,"_alpha",Regular.easeOut,100,0,12,false);
}
wrong2_btn.onRelease = function () {
new Tween(wrong4_mc,"_alpha",Regular.easeOut,0,100,12,false);
new Tween(wrong4_mc,"_alpha",Regular.easeOut,100,0,12,false);
}
wrong3_btn.onRelease = function () {
new Tween(wrong5_mc,"_alpha",Regular.easeOut,0,100,12,false);
new Tween(wrong5_mc,"_alpha",Regular.easeOut,100,0,12,false);
}
right_btn.onRelease = function () {
new Tween(right3_mc,"_alpha",Regular.easeOut,0,100,12,false);
new Tween(right3_mc,"_alpha",Regular.easeOut,100,0,12,false);
nextFrame();
}
Also, you must click "Select Level" then choose a level, then hit play for the game to start.
Any suggestions?
Thanks,
Mason
|
|
02-25-2008, 01:37 AM
|
#2
|
Status: I'm new around here
Join date: Feb 2008
Location:
Expertise:
Software:
Posts: 24
|
You might want to make sure you don't have any frames at all in that movie clip that way you won't have that problem since you're using the tween class anyway and not doing any frame animations. You can also try having the image in the same frame as the check mark if that's what you want.
|
|
02-25-2008, 04:26 AM
|
#3
|
Status: I'm new around here
Join date: Feb 2008
Location: Malaysia
Expertise:
Software:
Posts: 4
|
Hi. Here's what I would suggest you can try:
right_btn.onRelease = function () { var myTween:Tween = new Tween ( right3_mc, "_alpha", Regular.easeOut, 0, 100, 12, false );
new Tween ( right3_mc, "_alpha", Regular.easeOut, 100, 0, 12, false );
myTween.onMotionFinished = function () {nextFrame (); } }
What I've done is I've created a variable with the Tween data type called myTween. The Tween class has an event handler method called onMotionFinished which is called when the Tween is completed. You can find out more details in the help section under Components Language Reference > Tween class. There is a list of other event handlers there.
Hope that helps. Cheers!
|
|
02-26-2008, 01:58 AM
|
#4
|
Status: Junior Member
Join date: Mar 2007
Location: North Carolina
Expertise: Photography
Software:
Posts: 73
|
Alright, so I tried using the code you posted and it worked fine on one of the frames. When an image is selected (a correct answer) the checkmark is supposed to appear. For some reason, the checkmark didn't appear on the image it was supposed to. Everything is setup correctly and here's the code used:
Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
wrong1_btn.onRelease = function () {
new Tween(wrong3_mc,"_alpha",Regular.easeOut,100,0,12,false);
}
wrong2_btn.onRelease = function () {
new Tween(wrong4_mc,"_alpha",Regular.easeOut,100,0,12,false);
}
wrong3_btn.onRelease = function () {
new Tween(wrong5_mc,"_alpha",Regular.easeOut,100,0,12,false);
}
right_btn.onRelease = function () {
var myTween:Tween = new Tween ( right3_mc, "_alpha", Regular.easeOut, 100, 0, 12, false );
myTween.onMotionFinished = function () {
nextFrame ();
}
}
Any suggestions?
Thanks,
Mason
|
|
02-26-2008, 02:23 AM
|
#5
|
Status: Junior Member
Join date: Mar 2007
Location: North Carolina
Expertise: Photography
Software:
Posts: 73
|
Actually, figured out the problem. The checkmarks were on the wrong layers! Thanks again for all you've done.
-Mason
|
|
02-26-2008, 07:17 AM
|
#6
|
Status: I'm new around here
Join date: Feb 2008
Location: Malaysia
Expertise:
Software:
Posts: 4
|
Thats great! Glad you managed to get it working.
Cheers!
Zeke
|
|
02-27-2008, 01:50 AM
|
#7
|
Status: Junior Member
Join date: Mar 2007
Location: North Carolina
Expertise: Photography
Software:
Posts: 73
|
Hey Zeke_Chan,
I've actually come across another problem. I've fixed the checkmarks, but now the "x-marks" for the wrong answers are kind of whacky. I had to change the instance names for the checkmarks to work correctly. But I really don't want to have to go through this again. It's a lengthy process with all of the images I'm dealing with. Any other suggestions?
Thanks,
Mason
|
|
|
|
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
|