00:00
00:00
Newgrounds Background Image Theme

Herozaitama just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

HELP! ARRAY in FLASH

1,355 Views | 4 Replies
New Topic Respond to this Topic

HELP! ARRAY in FLASH 2015-02-22 11:11:44


this code below is to fade-in(effect) the buttons in one frame, this will do but in the picture below it can be possible? its not working so please help me thanks in advance

import fl.transitions.*;
import fl.transitions.easing.*;

function onTweenProgress(event:TweenEvent):void
{
// do something as the tween progresses...
}
function onTweenEnd(event:TweenEvent):void
{
// do something when the tween ends...
}
var prop:String = "alpha";
var from:Number = 0;
var to:Number = 1;
var duration:Number =5;

var tween:Tween = new Tween(startThegame, prop, Strong.easeOut, from, to, duration, true);
tween.addEventListener(TweenEvent.MOTION_CHANGE, onTweenProgress);
tween.addEventListener(TweenEvent.MOTION_FINISH, onTweenEnd);

var tween1:Tween = new Tween(settings, prop, Strong.easeOut, from, to, duration, true);
tween1.addEventListener(TweenEvent.MOTION_CHANGE, onTweenProgress);
tween1.addEventListener(TweenEvent.MOTION_FINISH, onTweenEnd);

HELP! ARRAY in FLASH

Response to HELP! ARRAY in FLASH 2015-02-22 21:44:47


You're going to get better responses in the Game Development forum.

Response to HELP! ARRAY in FLASH 2015-02-23 10:24:55


At 2/22/15 09:44 PM, WoogieNoogie wrote: You're going to get better responses in the Game Development forum.

ok sir

Response to HELP! ARRAY in FLASH 2015-02-23 17:32:40


If i understand you correctly i took your code and made a fade-in button that uses an array (testArray) to inform the tween about the object. Its hard for me to see your image but it seems that you forgot to tell the array which position of the array to use. Like Buttons[0] or Buttons[1]. If need be remember you can loop and use something like Buttons[i] &or tween[i]. Hope that helps.

import flash.events.MouseEvent;
import fl.transitions.*;
import fl.transitions.easing.*;

var count:uint = 0;
var testArray:Array = [butt_start];

function onTweenProgress(event:TweenEvent):void
{
// do something as the tween progresses...
	trace(count);
	count++;
}
function onTweenEnd(event:TweenEvent):void
{
// do something when the tween ends...
	trace(testArray[0]);
}
var prop:String = "alpha";
var from:Number = 0;
var to:Number = 1;
var duration:Number =5;
var tween:Tween = new Tween(testArray[0], prop, Strong.easeOut, from, to, duration, true);


tween.addEventListener(TweenEvent.MOTION_CHANGE, onTweenProgress);
tween.addEventListener(TweenEvent.MOTION_FINISH, onTweenEnd);


/*var tween1:Tween = new Tween(settings, prop, Strong.easeOut, from, to, duration, true);

tween1.addEventListener(TweenEvent.MOTION_CHANGE, onTweenProgress);
tween1.addEventListener(TweenEvent.MOTION_FINISH, onTweenEnd);*/


stop();

butt_start.addEventListener(MouseEvent.CLICK, gameStart);

function gameStart(evt:MouseEvent):void {
	play();
}

Response to HELP! ARRAY in FLASH 2015-02-24 09:48:12 (edited 2015-02-24 09:49:50)


it works! thanks sir :)