Copy link to clipboard
Copied
Hi
I keep getting an error when following the step by step instructions in the Adobe Press book "actionscript 3.0....flash pro CS5" classroom in a book, chapter 3, pg 59
It says:
"Scene 1, Layer 'actions', Frame 1, Line 72 1120: Access of undefined property None."
and the line it is refering to looks like this:
var tweenFadeOut:Tween = new Tween(instrument, "alpha", None.easeOut, 1, 0, 3, true);
What am I missing here?
import fl.transitions.easing.None;
Copy link to clipboard
Copied
import fl.transitions.easing.None;
Copy link to clipboard
Copied
The entire code looks like this:
import flash.events.MouseEvent;
import flash.events.Event;
import flash.display.MovieClip;
star_mc.addEventListener(MouseEvent.CLICK, rotateStar);
function rotateStar(e:MouseEvent):void {
star_mc.rotation +=5;
}
addEventListener(Event.ENTER_FRAME, starMove)
function starMove(e:Event):void {
if (star_mc.x < stage.stageWidth) {
star_mc.x += 2;
} else {
star_mc.x = 0;
}
}
var instrument:MovieClip = banjo;
import flash.display.MovieClip;
import fl.transitions.Tween;
instrument_txt.text = "Banjo Baby!"
violin.addEventListener(MouseEvent.CLICK, onViolin);
banjo.addEventListener(MouseEvent.CLICK, onBanjo);
trumpet.addEventListener(MouseEvent.CLICK, onTrumpet);
glock.addEventListener(MouseEvent.CLICK, onGlock);
function onViolin(e:MouseEvent):void {
instrument = violin
instrument_txt.text = "Violin Baby";
}
function onBanjo(e:MouseEvent):void {
instrument = banjo
instrument_txt.text = "Banjo Baby";
}
function onTrumpet(e:MouseEvent):void {
instrument = trumpet
instrument_txt.text = "Trumpet Baby";
}
function onGlock(e:MouseEvent):void {
instrument = glock
instrument_txt.text = "Glock Baby";
}
grow_btn.addEventListener(MouseEvent.CLICK, grow);
shrink_btn.addEventListener(MouseEvent.CLICK, shrink);
rotate_btn.addEventListener(MouseEvent.CLICK, rotate);
hide_btn.addEventListener(MouseEvent.CLICK, hideClip);
show_btn.addEventListener(MouseEvent.CLICK, showClip);
fadeOut_btn.addEventListener(MouseEvent.CLICK, fadeOut);
fadeIn_btn.addEventListener(MouseEvent.CLICK, fadeIn);
function grow(e:MouseEvent):void {
instrument.scaleX += .1
instrument.scaleY += .1;
}
function shrink(e:MouseEvent):void {
instrument.scaleX -= .1
instrument.scaleY -= .1;
}
function rotate(e:MouseEvent):void {
instrument.rotation += 5;
}
function hideClip(e:MouseEvent):void {
instrument.visible = false;
}
function showClip(e:MouseEvent):void {
instrument.visible = true;
}
function fadeOut(e:MouseEvent):void {
var tweenFadeOut:Tween = new Tween(instrument, "alpha", None.easeOut, 1, 0, 3, true);
}
function fadeIn(e:MouseEvent):void {
instrument.alpha = 1;
}
Copy link to clipboard
Copied
Go all the way to the bottom of the page, you need to add in the transition.easing classes. Then it should work as expected.
Copy link to clipboard
Copied
Thanks,
I see importing the "fl.transitions.easing.None;" does the job.
How can I import all easing classes, or cant I?
Scuze the simple questions, but this is all very new to me.
Copy link to clipboard
Copied
that should work:
import fl.transitions.easing.*;
Copy link to clipboard
Copied
It does indeed, thanks
In the book it says that CS5 can do automatic insertion of import statements...
Do you know where to set this preference?
Copy link to clipboard
Copied
Just type in, say "no", and then cmd + space (which is on Mac; use whatever the equivalent on PC - ctrl + space?). You should get a list of classes/functions/variables begin with "no". "None" will be one of them. Select it and return.
This is the behaviour Flash IDE copied from Eclipse (Flex/Flash Builder).
Find more inspiration, events, and resources on the new Adobe Community
Explore Now