FORUMS: list search recent posts

flash error

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
fionnlagh ballantine
flash error
on Jun 6, 2011 at 9:52:12 pm

Hello,

I followed a youtube video to create a 3D page flip in flash, the video is for cs4, i'm using cs5, maybe that is the problem. this is the url.





this is my actionscript, using actionscript3,



import fl.transitions.Tween;
import fl.transitions.easing.Strong;
import fl.transitions.TweenEvent;
import flash.events.Event;

con.sidea.flip.addEventListener(MouseEvent.Click,onflip);
con.sideb.flip.addEventListener(MouseEvent.click,onflip);
addEventListener(Event.ENTER_FRAME,loop);

var isStill:Boolean=true;
var arraytween:Array = new Array();

function onflip (e:Event) {
if (isStill) {
arraytween.push(new Tween(con,'rotationY',Strong.easeOut,con.rotationY,con.rotationY+180,1,true));
arraytween[0].addEventListener(Tween.MOTION_FINISH,reset);
isStill=false;

}
}
function reset(e:Event) {
isStill=true;
arraytween=[];

}
function loop(e:Event) {
if (con.rotationY>90 && con.rotationY<=270) {
con.addChild(con.sideb);
con.scaleX=1;
} else {
con.addChild(con.sidea);
con.scaleX=1;
}
if (con.rotationY>=360) {
con.rotationY=0;
}
}

there were no problems until I tested the movie clip, the button didn't work and these three messages appeared, my button didn't work andI don't know why.

Scene1, larger'as3,frame1,line18 1119;access of possibly undefined property MOTION_FINISH through a reference with static type class

Scene1,layer'as3,frame1,line6 access of possibly undefined property Click through a reference with static type class

scene 1,layer'as3,frame1,line 7 1119:access of possibly undefined property click through a reference with static type class


Return to posts index

demetri tashie
Re: flash error
on Jun 7, 2011 at 5:15:35 am

the first problem is that your MouseEvent Listeners need to have the event 'CLICK' written in capitals.
you have it as:
con.sidea.flip.addEventListener(MouseEvent.Click,onflip);
con.sideb.flip.addEventListener(MouseEvent.click,onflip);


and it should be:
con.sidea.flip.addEventListener(MouseEvent.<b>CLICK</b>, onflip);
con.sideb.flip.addEventListener(MouseEvent.<b>CLICK</b>, onflip);


the second is you have two things wrong in your conditional . first condition should be greater than or equal to 90, not just greater than 90 , and the second thing is your assigning con.scaleX value in the first condition should be negative one not positive one
you had:
unction loop(e:Event) {
if (con.rotationY<b>>90</b> && con.rotationY<=270) {
con.addChild(con.sideb);
con.scaleX<b>=1</b>;


and it should be:
unction loop(e:Event) {
if (con.rotationY<b>>=90</b> && con.rotationY<=270) {
con.addChild(con.sideb);
con.scaleX=<b>-1</b>;


the third problem is the event calling the reset function is a TweenEvent,not a Tween. you had:
arraytween[0].addEventListener(<b>Tween</b>.MOTION_FINISH,reset);

and it should be:
arraytween[0].addEventListener(<b>TweenEvent</b>.MOTION_FINISH,reset);

if you fix those mistakes, it will work as expected. you really do need to be exacting and careful when writing, and especially when copying or transcribing, code.

hope that helps


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]