Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 1060 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     Flash and Actionscript :

Flash Problems With ActionScript

Thread title: Flash Problems With ActionScript
Closed Thread    
    Thread tools Search this thread Display Modes  
02-24-2008, 05:57 PM
#1
mason.sklut is offline mason.sklut
mason.sklut's Avatar
Status: Junior Member
Join date: Mar 2007
Location: North Carolina
Expertise: Photography
Software:
 
Posts: 73
iTrader: 0 / 0%
 

mason.sklut is on a distinguished road

  Old  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
Tom W is offline Tom W
Tom W's Avatar
Status: I'm new around here
Join date: Feb 2008
Location:
Expertise:
Software:
 
Posts: 24
iTrader: 0 / 0%
 

Tom W is on a distinguished road

  Old

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
zeke_chan is offline zeke_chan
Status: I'm new around here
Join date: Feb 2008
Location: Malaysia
Expertise:
Software:
 
Posts: 4
iTrader: 0 / 0%
 

zeke_chan is on a distinguished road

Send a message via MSN to zeke_chan Send a message via Yahoo to zeke_chan

  Old

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
mason.sklut is offline mason.sklut
mason.sklut's Avatar
Status: Junior Member
Join date: Mar 2007
Location: North Carolina
Expertise: Photography
Software:
 
Posts: 73
iTrader: 0 / 0%
 

mason.sklut is on a distinguished road

  Old

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
mason.sklut is offline mason.sklut
mason.sklut's Avatar
Status: Junior Member
Join date: Mar 2007
Location: North Carolina
Expertise: Photography
Software:
 
Posts: 73
iTrader: 0 / 0%
 

mason.sklut is on a distinguished road

  Old

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
zeke_chan is offline zeke_chan
Status: I'm new around here
Join date: Feb 2008
Location: Malaysia
Expertise:
Software:
 
Posts: 4
iTrader: 0 / 0%
 

zeke_chan is on a distinguished road

Send a message via MSN to zeke_chan Send a message via Yahoo to zeke_chan

  Old

Thats great! Glad you managed to get it working.

Cheers!
Zeke

02-27-2008, 01:50 AM
#7
mason.sklut is offline mason.sklut
mason.sklut's Avatar
Status: Junior Member
Join date: Mar 2007
Location: North Carolina
Expertise: Photography
Software:
 
Posts: 73
iTrader: 0 / 0%
 

mason.sklut is on a distinguished road

  Old

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

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed