hello all! I’m taking a swing at flash again. I am wondering how i can set the opacity of a movie to dissapear as it nears the edge of my stage.
Right now i am creating an array of my movie ‘word’ to randomly generate up to 10 instances moving at random speeds and appearing with random opacity. here is my code so far:
var TargetWordsArray:Array = new Array();
var maxTargetWords:Number = 10;
function addTargetWords(e:Event)
{
var word:TargetWords = new TargetWords();
word.x = Math.random() * stage.stageWidth/2;
word.y = Math.random() * stage.stageHeight/2;
word.alpha = Math.random() *.8 + .2;
word.scaleX = word.scaleY = Math.random() * .8 + .2;
word.xMovement = Math.random() * 10-5;
word.yMovement = Math.random() * 10-5;
TargetWordsArray.push(word);
addChild(word);
word.cacheAsBitmap = true;
if (TargetWordsArray.length >= maxTargetWords)
{
removeChild(TargetWordsArray.shift());
}
word.addEventListener(Event.ENTER_FRAME,moveTargetWords);
}
function moveTargetWords(e:Event)
{
e.currentTarget.x += e.currentTarget.xMovement;
e.currentTarget.y += e.currentTarget.yMovement;
}
var myTimer:Timer = new Timer(100);
myTimer.addEventListener(TimerEvent.TIMER, addTargetWords);
myTimer.start();
So i need to figure out how to set the opacity to lower as it nears the edge of te stage. And then i need to set it so that the left 250 pixels is the left edge it dissapears to so it does not cover the logo.
[COLOR=#800080]www.norcaldesigns.com[/COLOR]
Roseville Website Design.