Groups | Blog | Home
all groups > flash actionscript > january 2004 >

flash actionscript : how to create a script to handle both alpha and motion?


FayeC
1/24/2004 11:00:55 PM
I am having a hard time figuring out how to create a script that will handle
both alpha and motion.
The script I have for motion works just fine but if I add the alpha script
to it either the alpha won't work but the motion does or none of them work
at all.
the script in question is:

text4_mc._alpha = 0;
text4_mc.onEnterFrame = function() {
this._x-=(this._x-box1_mc._x)*.1
this._y-=(this._y-box1_mc._y)*.1
if (this._alpha <101) {
this._alpha += 10;
}
};

Can anybody help me solve this problem?



Thank you in advance,



FayeC

Peter Blumenthal
1/25/2004 10:20:40 AM
hmm - from your script i would not expect the motion to work, unless box1_mc
is nested within the clip you are assigning the onEnterFrame handler to - i
would imagine you should use _parent.box1_mc or _root.box1_mc

Other than that, there's nothing wrong with the script. I created a new
movie, made an mc called text4_mc and put this as on the main timeline:

text4_mc._alpha = 0;
text4_mc.onEnterFrame = function() {
this._x++
this._y ++
if (this._alpha<101) {
this._alpha += 10;
}
};


and it works as expected.



--
---------------------------------------
http://www.phageinteractive.com
PhageInteractive Ltd.
remove mm_ to mail
---------------------------------------
'I wish we lived in a world where it was possible to be religious and think
at the same time.' - Jonh Graves


[quoted text, click to view]

FayeC
1/25/2004 2:13:03 PM
I might have a problem here then....
I got your script and did what you described: created a new file with a new
text4_mc and added the script to the main timeline after I named the
instance text4_mc.
It moves (slowly due to the ++ - a little faster when I used +=10 instead)
and still no alpha.....
Any clues??

FayeC

[quoted text, click to view]

Peter Blumenthal
1/26/2004 9:48:10 AM
how strange! zip the fla and post a link to , so i can take a look?


}`¬P
--
---------------------------------------
http://www.phageinteractive.com
PhageInteractive Ltd.
remove mm_ to mail
---------------------------------------
'I wish we lived in a world where it was possible to be religious and think
at the same time.' - Jonh Graves

AddThis Social Bookmark Button