|
-
Error #1009, Dynamic MovieClips dont want to work
ok so i have a lil or big problem, im practicing on how to do websites in flash cs4 using AS3.0, so im doin a basic dynamic test website, all the codes seem to be fine because i dont get any compilers errors. but one Error that is driving me nuts is the Error #1009 which says.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at fl.transitions::Tween/setPosition()
at fl.transitions::Tween/set position()
at fl.transitions::Tween()
at bringinmctostageas2_fla::MainTimeline/onClick()
i read already that it might be that im calling something by the wrong name, or that i misspelled something. but to my knowledge everything seem good, i did everything twice before asking for help, but i couldnt fix it.. i hope some1 here can help me out.
This is my code:
Code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
home_mc.addEventListener(MouseEvent.CLICK, onClick);
contact_mc.addEventListener(MouseEvent.CLICK, onClick);
about_mc.addEventListener(MouseEvent.CLICK, onClick);
products_mc.addEventListener(MouseEvent.CLICK, onClick);
home_mc.buttonMode = true;
contact_mc.buttonMode = true;
about_mc.buttonMode = true;
products_mc.buttonMode = true;
home_mc.mcTarget = home
contact_mc.mcTarget = contact
about_mc.mcTarget = about
products_mc.mcTarget = products
/*the current and nextpage are variables that are going to
help us go from one page to the other, instead of making each
button go to a different page, in other words is going to keep
track of what page we're on and what page we're going to*/
var currentPage:MovieClip = home;
var nextPage:MovieClip;
/*to be able to bring the movieclips into the stage i need to,
first give the movieclips class names and then import then
into the stage by using variables*/
var home:homePage = new homePage();
var contact:contactPage = new contactPage();
var about:aboutPage = new aboutPage();
var products:productsPage = new productsPage();
/*by default the home page is going to animate in*/
home.alpha = 0;
home.x = 20;
home.y = 60;
addChild(home);
/*this is to make the movieclip fade in, i need to create a new tween
and then specify what i want to do with it. */
var myTween:Tween = new Tween(home,"alpha",Strong.easeOut,0,1,3,true);
function onClick(e:MouseEvent):void
{
/*the nextPage = e.currentTarget.mcTarget is to trigger the onClick function
to go and play the next page page because the mcTarget is any of the pages
cause thats what we called it a the top*/
nextPage = e.currentTarget.mcTarget
var offTween:Tween = new Tween(currentPage,"alpha",Strong.easeOut,1,0,3,true);
offTween.addEventListener(TweenEvent.MOTION_FINISH, onTween);
}
/*if i want to remove somethin from the stage i need to use the removeChild
and then specify what i want it to do*/
function onTween(e:TweenEvent):void
{
/*removeChild(currentPage) is to remove the current page, which the properties are
from the home_mc which are going to apply to all the other pages, and the current
page then its going to and fade out, because of the next page funciton above.*/
removeChild(home);
currentPage = nextPage
currentPage.alpha = 0;
currentPage.x = 20;
currentPage.y = 60;
addChild(currentPage);
var tweenOn:Tween = new Tween(currentPage,"alpha",Strong.easeOut,0,1,1,true);
}
thankx in advance
-
#1009 error
Hai buddy i got the same problem its because its run in local... you just upload it in your local server and check, it ll run... perfect.........
If still not work send your file(if u want) i l check and tell you
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|