Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Where is the mistake?

Guest
Feb 01, 2011 Feb 01, 2011

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?


TOPICS
ActionScript
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Feb 01, 2011 Feb 01, 2011

import fl.transitions.easing.None;

Translate
Community Expert ,
Feb 01, 2011 Feb 01, 2011

import fl.transitions.easing.None;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 01, 2011 Feb 01, 2011

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;
}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 01, 2011 Feb 01, 2011

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 01, 2011 Feb 01, 2011

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 01, 2011 Feb 01, 2011

that should work:

import fl.transitions.easing.*;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 01, 2011 Feb 01, 2011

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 01, 2011 Feb 01, 2011
LATEST

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).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines