TypeError: Error #1009 with hit test plz help
//-----Actions and Events -----
stage.addEventListener(MouseEvent.MOUSE_MOVE,charMove);
function charMove(evt:MouseEvent)
addEventListener(Event.ENTER_FRAME, checkcharCollision);
function checkcharCollision(event:Event)
for (var i:uint=0; i<char.length; i++)
if (char[i].hitTestObject(cur))
char.splice(i,1);
lalLChannel = lalL.play();
lalL_transform.volume = 1;
lalLChannel.soundTransform = lalL_transform;
lalBtn.gotoAndStop("ful");
lalLChannel.addEventListener(Event.SOUND_COMPLETE, lalLComplete);
and it gives me this error as soon as i move the mouse:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at INDEX_fla::MainTimeline/checkcharCollision()
ny ideas?
thx pavel
stage.addEventListener(MouseEvent.MOUSE_MOVE,charMove);
function charMove(evt:MouseEvent)
addEventListener(Event.ENTER_FRAME, checkcharCollision);
function checkcharCollision(event:Event)
if (char[0].hitTestObject(cur))
trace("ok");
and this?
After such an error you sould minimize your codes and then add line by line your codes.
At some point you will find the error.
Similar Messages
-
TypeError: Error #1009 - (Null reference error) With Flash.
I am not an expert in flash, but i do work with AS and tweak Flash projects , though not having deep expertise in it. Currently i need to revamp a flash website done by one another guy, and the code base given to me, upon execution is throwing the following error.
"--- TypeError: Error #1009: Cannot access a property or method of a null object reference. at NewSite_fla::MainTimeline/__setProp_ContactOutP1_ContactOut_Contents_0() at NewSite_fla::MainTimeline/frame1() --"
The structure of the project is like, it has the different sections split into different movie clips. There is no single main timeline, but click actions on different areas of seperate movie clips will take them between one another. All the AS logic of event handling are written inline in FLA , no seperate Document class exists.
Preloader Movie clip is the first one getting loaded. As i understood the error is getting thrown initially itself, and it is not happening due to any Action script logic written inline, because it is throwing error even before hitting the first inline AS code.
I am not able to figure Out what exactly it causing the problem, or where to resolve it. I setup the stuff online, for reference if anybody want to take a look at it, and here is the link.You need to have flash debugger turned ON in your browser, if need to see the exception getting triggered.
http://tinyurl.com/2alvlfx
I really got stuck at this point. Any help will be great.I had not seen the particular solution i am looking for anywhere yet, though Error #1009 is common.Thanks, for putting effort in helping me. I debugged the movie.The line of code being shown is this >>
if(__setPropDict[ContactOutP1]== undefined || ! ((int(__setPropDict[ContactOutP1]) >= 1 && int(__setPropDict[ContactOutP1]) <=5))){
__setPropDict[ContactOutP1] = currentFrame;
__setProp_ContactOutP1_ContactOut_Contents_0();
And i think this third line of code is where the exception is being thrown. But as i understood, this code is not written by the developer. I had nto seen this code, anywhere in the actions. Hopefully this will give you hint about what is exactly causing the issue and what can be done to resolve it. -
I'am the just start learning actionscript 3, follow is my code, when i lauch the code, it still report the error in frame 36 but did not locate the error in which line. please help me debug them.... TypeError: Error #1009: Cannot access a property or method of a null object reference.
stop();
fm_button.visible = false;
import caurina.transitions.*;
var menu_label_North:Array = new Array("Animals Collection",
"Flowers Collection",
"Leaves Collection",
"Mixed Collection",
"Extra Collection",
"Special Awards",
"Company Background",
"Contact Information");
var total_north:Number = menu_label_North.length;
var i_north:Number = 0;
var page_north:Number;
var main_menu_North:MovieClip = new MovieClip();
stage.addChild(main_menu_North);
for (i_north = 0; i_north < total_north; i_north++)
var btn_north = new flashmo_button();
btn_north.name = "btn" + i_north;
btn_north.x = fm_button.x + i_north * ( fm_button.width + 12 );
btn_north.y = fm_button.y;
btn_north.buttonMode = true;
btn_north.item_no = i_north;
btn_north.flashmo_click_area.addEventListener( Event.ENTER_FRAME, btn_enter_north );
var each_substring_north:Array = menu_label_North[i_north].split("|");
btn_north.flashmo_button_label.fm_label.text = each_substring[0];
btn_north.item_url = each_substring[1];
main_menu_North.addChild(btn_north);
function btn_over_north(e:MouseEvent):void
e.target.parent.over = true;
function btn_out_north(e:MouseEvent):void
e.target.parent.over = false;
function btn_click_north(e:MouseEvent):void
var mc= e.target.parent;
if ( mc.item_url != undefined )
navigateToURL( new URLRequest( mc.item_url ), "_parent" );
else
change_page_north(mc.item_no);
function btn_enter_north(e:Event):void
var mc_north = e.target.parent;
if ( mc_north.over == true )
mc_north.nextFrame();
else
mc_north.prevFrame();
function change_page_north(no:Number):void
for (var i:Number = 0; i < main_menu_North.numChildren; i++)
var mc = MovieClip( main_menu_North.getChildAt(i) );
mc.over = false;
mc.flashmo_click_area.visible = true;
mc.flashmo_click_area.addEventListener( MouseEvent.ROLL_OVER, btn_over_north );
mc.flashmo_click_area.addEventListener( MouseEvent.ROLL_OUT, btn_out_north );
mc.flashmo_click_area.addEventListener( MouseEvent.CLICK, btn_click_north );
var mc_selected = MovieClip( main_menu_North.getChildAt(no) );
mc_selected.over = true;
mc_selected.flashmo_click_area.visible = false;
mc_selected.flashmo_click_area.removeEventListener( MouseEvent.ROLL_OVER, btn_over_north );
mc_selected.flashmo_click_area.removeEventListener( MouseEvent.ROLL_OUT, btn_out_north );
mc_selected.flashmo_click_area.removeEventListener( MouseEvent.CLICK, btn_click_north );
page_north = no + 1;
play();
change_page_north(0);// default page on load
flashmo_credit.addEventListener( MouseEvent.CLICK, goto_fm_north );
function goto_fm_north(e:MouseEvent):void
navigateToURL( new URLRequest( "http://www.flashmo.com" ), "_parent" );
music_credit.addEventListener( MouseEvent.CLICK, goto_music_north );
function goto_music_north(e:MouseEvent):void
navigateToURL( new URLRequest(
"http://www.premiumbeat.com/royalty_free_music/byPiece.php?id=2614" ),
"_blank" );click file>publish settings>swf and tick "permit debugging". retest.
the line number of the code that contains that non-existant object you're trying to reference will be in the error message. indicate that line of code if you're not sure which object that is. -
TypeError: Error #1009- help needed
Hi,
I'm working on a school project, which is to say I'm still pretty new to AS3.
I keep receiving error 1009 which seems to point to the problematic "theory" section. I've checked my label & instance names numerous times- everything looks fine. What else might it be?
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Untitled_fla::MainTimeline/frame70()
The buttons fade into view over the course of 5 frames.. so they are on the stage but invisible starting at frame 65, and by frame 70 they are in the same spot and fully visible & supposed to be functional.
I have the actionscript on a separate layer on frame 70, this is what I have-
stop();
theory_btn.addEventListener(MouseEvent.CLICK,playtheory);
function playtheory(event:MouseEvent):void{
gotoAndPlay("theory");
history_btn.addEventListener(MouseEvent.CLICK,playhistory);
function playhistory(event:MouseEvent):void{
gotoAndPlay("history");
future_btn.addEventListener(MouseEvent.CLICK,playfuture);
function playfuture(event:MouseEvent):void{
gotoAndPlay("future");
credits_btn.addEventListener(MouseEvent.CLICK,playcredits);
function playcredits(event:MouseEvent):void{
gotoAndPlay("credits");
I've checked all of my labeling mulitple times- all names and instances are correct and in their proper places.. Unless it's a mindblowingly obvious mistake and I'm just not catching it.
I'd like to upload my .fla, but it's too large of a file. I will happily email it if anyone is willing to take a peek.I may be wrong, but for the original problem I am guessing that the following of what I listed was the problem...
- is animated into place but is not assigned instance names in every keyframe for it
You mentioned frame 70 is where alpha = 1, which has me thinking you animated them into view but did not name them in the first frame(s). That lack of a name will get inherited at the other end of the tween.
For your new problem, if your home page is on frame 75, and your code for the home button is on frame 76, you have to stop at frame 76 for the code to be assigned, otherwise, going to another frame will leave it without that code getting assigned for the home button.
What you can do is have the home button and its code in frame 75, but make it invisible there, and in your other function for the other buttons, turn it visible.
I tried to show the code but the editor is playing games and deleting stuff on me as I add it. -
I am getting this message in the output tab for buttons that I am trying to create. Here's the code:
import flash.events.MouseEvent;
stop();
function goHome(myEvent:MouseEvent):void {
gotoAndStop("home");
SoundMixer.stopAll();
function goAbout(myEvent:MouseEvent):void {
gotoAndStop("about");
SoundMixer.stopAll();
function goBusiness(myEvent:MouseEvent):void {
gotoAndStop("business");
SoundMixer.stopAll();
function goContact(myEvent:MouseEvent):void {
gotoAndStop("contact");
SoundMixer.stopAll();
function goArchives(myEvent:MouseEvent):void {
gotoAndStop("archives");
SoundMixer.stopAll();
function goBioTech(myEvent:MouseEvent):void {
gotoAndStop("bioTech");
SoundMixer.stopAll();
function goRealEstate(myEvent:MouseEvent):void {
gotoAndStop("realEstate");
SoundMixer.stopAll();
function goTechnology(myEvent:MouseEvent):void {
gotoAndStop("technology");
SoundMixer.stopAll();
function goEnergy(myEvent:MouseEvent):void {
gotoAndStop("energy");
SoundMixer.stopAll();
home_btn.addEventListener(MouseEvent.CLICK, goHome);
about_btn.addEventListener(MouseEvent.CLICK, goAbout);
business_btn.addEventListener(MouseEvent.CLICK, goBusiness);
contact_btn.addEventListener(MouseEvent.CLICK, goContact);
archives_btn.addEventListener(MouseEvent.CLICK, goArchives);
bioTech_btn.addEventListener(MouseEvent.CLICK, goBioTech);
realEstate_btn.addEventListener(MouseEvent.CLICK, goRealEstate);
technology_btn.addEventListener(MouseEvent.CLICK, goTechnology);
energy_btn.addEventListener(MouseEvent.CLICK, goEnergy);
I ran the debugger and got this:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at peakInsights_fla::MainTimeline/frame1()[peakInsights_fla.MainTimeline::frame1:48]
I guess it's telling me there's a problem with line 48 but what?
The home, about, business, contact, and archives button works. On the business page there are the remaining buttons biotech, technology, real estate, and energy. when i test it; i get the finger but the buttons don't work. this is my first flash site so I'am new, new.I followed the steps and read some of your comments on the same top topic in another thread. When I put it on the first frame it was okay but the next button on that page had the same problem. So what I am guessing is that I have to either create a document class or put the actions where the buttons are. Am I understanding that correctly? In the other thread in which you helped someone else; there was so comments about document class. I found a tutorial on it and the way I understand it is that it you can put you actions in an external document. But you have to include in the event listener the frame in which you want that action to happen.
Thaks for your help. And patience. -
Hi,
I need your help please - I have to update one of my iOS Apps. In this App I use Box2d for a simple maze game (it's an app for kids). When I publish & test this game on my Mac it works fine. I can drag my Hero (fish) through this Maze and all collision detections, gravity etc. work perfect.
When I test it on my iPad it doesn't work. The device debugger shows this error message:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at global$init()
at global$init()
at Box2DAS.Common::b2Base$/initialize()[/Users/jan/Documents/_Projekte/Spielplatz/Universal_ Retina/src/com/Box2DAS/Common/b2Base.as:31]
at wck::WCK/create()[/Users/jan/Documents/_Projekte/Spielplatz/Universal_Retina/src/com/wck/ WCK.as:26]
at misc::Entity/ensureCreated()[/Users/jan/Documents/_Projekte/Spielplatz/Universal_Retina/s rc/com/misc/Entity.as:50]
at misc::Entity/handleAddedToStage()[/Users/jan/Documents/_Projekte/Spielplatz/Universal_Ret ina/src/com/misc/Entity.as:100]
at misc::Entity/handleAddedToStage()
Line 31: loader = new CLibInit();
I guess "CLibInit" should come from the .swc file.
The thing is:
I didn't change anything in this maze game - it seems this has to do something with the new Flash and/or Adobe Air version. Box2D.swc file is included:
It always worked like this - and it works when testing it on my Mac - but it is no longer working on my current system.
So I started my Mac from an older system (10.9.5 on an external HD) and published the App from Flash CS6 and Adobe Air 13.0 - then it suddenly worked on my iPad as before. I was able to tap an the fish and drag it arround.
The same project / app published from my current OS X 10.10 + Flash CC 2014 + Adobe Air 15.0.0.302 is not working. I always receive this Error Message - I can not drag the fish - nothing happens. And I have no idea why this happens and what else I could do. I searched the whole day for a solution but didn't find anything.
So did anything change by the way Flash and/or Air handles .swc files? Is there an other way to include: import cmodule.Box2D.* / CLibInit ?
Please - if anyone has a clue - please let me know!!
Best regards
JanUpdate:
There is also an Android Version of this App. I just published and tested a new version of it on my kindle fire & Samsung Galaxy Tab 2. On both Tablets the maze works perfect. I'm able to drag the fish around etc.
Then I published this Android Version for iOS and tested it on my iPad. Again I'm getting the Error message:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at global$init()
at global$init()
at Box2DAS.Common::b2Base$/initialize()[/Users/jan/Documents/_Projekte/Spielplatz/Universal_ Retina/src/com/Box2DAS/Common/b2Base.as:31]
at wck::WCK/create()[/Users/jan/Documents/_Projekte/Spielplatz/Universal_Retina/src/com/wck/ WCK.as:26]
at misc::Entity/ensureCreated()[/Users/jan/Documents/_Projekte/Spielplatz/Universal_Retina/s rc/com/misc/Entity.as:50]
at misc::Entity/handleAddedToStage()[/Users/jan/Documents/_Projekte/Spielplatz/Universal_Ret ina/src/com/misc/Entity.as:100]
at misc::Entity/handleAddedToStage
...and the fish is stuck - I can't drag it - nothing happens. So this error only occurs when I publish the App for iOS - as an .ipa. Did anything change in the way Air handles .swc files?
I'm totally confused
If anybody has an idea what I could try - PLEASE LET ME KNOW!! -
When i use papervision in flash builder and i am doing a test, when i render a sphere using papervision with the following code it renders me the sphere.
When i add a line sphere.pitch(2); ||
sphere.yaw(2);
sphere.roll(2);
i get the following error,
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at PvTest/onRenderTick()[D:\Android 3D\PvTest\src\PvTest.as:39]
Can anyone help me figure out the error
For additional Info, these are the imports i am doing:
import org.papervision3d.objects.primitives.Sphere;
import org.papervision3d.view.BasicView;I followed the steps and read some of your comments on the same top topic in another thread. When I put it on the first frame it was okay but the next button on that page had the same problem. So what I am guessing is that I have to either create a document class or put the actions where the buttons are. Am I understanding that correctly? In the other thread in which you helped someone else; there was so comments about document class. I found a tutorial on it and the way I understand it is that it you can put you actions in an external document. But you have to include in the event listener the frame in which you want that action to happen.
Thaks for your help. And patience. -
ActionScript TypeError: Error #1009?
Okay, so I was on this website earlier, www.peterdavid.net and tried to view a video that Vevo was hosting directly on the site's homepage, when it loaded up till about 56% an ActionScript error came up saying basicallly something like:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.vevo.mx::MenuScreenContainer/setModelInfo()
at EmbeddedPlayer/bootstrapCompleteHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at org.swizframework::Swiz$/dispatchEvent()
at com.vevo.controller::BootstrapController/checkAsyncCalls()
at com.vevo.controller::BootstrapController/youTubeReadyHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at org.swizframework::Swiz$/dispatchEvent()
at EmbeddedPlayer/playerReadyHandler()
at EmbeddedPlayer/__corePlayer_playerReady()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()
at com.vevo.view.controls::CorePlayer/playerReadyHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()
at com.vevo.view.controls::AS3YouTubePlayer/onPlayerReady()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.google.youtube.application::SwfProxy/onExternalEvent()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.google.youtube.model::YouTubeEnvironment/broadcastExternal()
at com.google.youtube.application::VideoApplication/build()
at com.google.youtube.application::Application/onInited()
at com.google.youtube.application::VideoApplication/onInited()
at com.google.youtube.application::Application/initData()
at com.google.youtube.application::VideoApplication/initData()
at com.google.youtube.application::Application/init()
at com.google.youtube.application::VideoApplication/init()
at com.google.youtube.application::Application/onInit()
Now my question is really, first of all, is this a problem with the website or with my computer, second, how do I fix this, and yeah I don't know anything about ActionScript, I was not trying to write one at all I simply came across a website and this happened during the video playing. Any thoughts?
EDIT: not sure if it would help, but the options I had were to Dismiss All and Continue.
Thanks in advance.Usually this type of error is caused by the website, rather than your Flash Player installation. If you tell us what video on the website is causing it, someone here can test it.
What OS and browser are you using?
Also, is 'third-party content' checked on the Flash Player Settings Manager at http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager.html ? -
Another TypeError: Error #1009 Problem
Hey all, I've searched the 'net and searched these forums but can't seem to figure out what I'm doing wrong. I'm creating a flash based game for school that so far has ten frames on the timeline. I have buttons on frame one, frame 5, and frame 10. I have actionscript code to control those buttons on frame 1, frame 5, and frame 10 respectively. The code is worded identically on each frame with the exception that I've changed the button names and the function names that are called when the mouse button is pressed. The code works fine on frame 1 and on frame 5, but when I click the button on frame 5 that sends me to frame 10, I get this error immediately:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at keys2BibleTest_fla::MainTimeline/frame10()
at flash.display::MovieClip/gotoAndStop()
at keys2BibleTest_fla::MainTimeline/stormBtnHandler1()
I have verified that each instance of the buttons do indeed have the name of the button being listened for in the event handlers. I can change the type from button to movieclip and it works fine. I can also remove frames 1 through 9 and the code works.
Here's the code:
Frame 1:
stop();
enterBtn.addEventListener(MouseEvent.MOUSE_DOWN, enterBtnHandler1);
function enterBtnHandler1(event:MouseEvent):void {
gotoAndStop(5, "Scene 1");
Frame 5:
import flash.events.MouseEvent;
stormBtn.addEventListener(MouseEvent.MOUSE_DOWN, stormBtnHandler1);
function stormBtnHandler1(event:MouseEvent):void {
gotoAndStop(10, "Scene 1");
chickenOutBtn.addEventListener(MouseEvent.MOUSE_DOWN, chickenOutBtnHandler1);
function chickenOutBtnHandler1(event:MouseEvent):void {
gotoAndStop(1, "Scene 1");
Frame 10:
import flash.events.MouseEvent;
creationBtn.addEventListener(MouseEvent.MOUSE_DOWN, creation);
function creation(event:MouseEvent):void {
gotoAndStop(3, "Scene 1");
lifeBtn.addEventListener(MouseEvent.MOUSE_DOWN, lifeOfChrist);
function lifeOfChrist(event:MouseEvent):void {
navigateToURL(new URLRequest("http://www.ceoutreach.org"));
I can't for the life of me figure out what's wrong. Can anyone help?
Thank you,
MikeNed,
thank you for your reply. Unfortunately, my buttons are on separate layers and separated by blank keyframes to boot. When I posted originally, the buttons were all on the same layer BUT separated by blank keyframes. After doing some research on the web, I moved the buttons to their own separate layers (one button per layer) and kept the blank keyframes as well.
Currently, my only filled keyframes are one, five, and ten. All other keyframes are blank except for my labels and actionscript code. I'm using separate layers for labels and actions, too. I attempted to attach the file with my original post but received the message that .fla files are not allowed. I don't know about your window, but mine says Max size 5.0 MB (my file is 2), All files types allowed except.... .fla is not one of those in the exception list so I expected it to go.
It's got something to do with the two buttons on frame 10.... I just went into the actionscript and bypassed frame 5, going directly to frame 10 when the Enter button is depressed, and got the same error message. There's something in the code I'm just not seeing.... when I comment out the code for the buttons, no error message. Put the code back in, error message comes back. Delete the buttons and the code and insert new ones, the error message comes back.
It's got me totally stumped.
Thank you for trying,
Mike
Edit: I forgot to mention, frame ten is the only place on the timeline where instances of these particular buttons are being used. The other frames are populated with different buttons. Also, when I change the type to movieclip, everything works. Weird, huh? -
Stupid TypeError: Error #1009:
Ok, guys I have posted this same question to a few forums but no luck. So heres my problem that im getting when I complile my swf. I get this stupid, compiling error message, I know what its reffering to but I tried tackleing the line which its referring to but no luck.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at net.schemagroup.ui::Interface/revealDropDown()[/Users/abel/Desktop/mySite/fla/net/schemag roup/ui/Interface.as:174]
at net.schemagroup::LatestWorks/initRevealDropDown()[/Users/abel/Desktop/mySite/fla/net/sche magroup/LatestWorks.as:407]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at SetIntervalTimer/onTimer()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
So basically i'm just calling a instance method from my LatestWorks.as class. Which this instance method is defined in Interface.as class also, my Interface.as class is initialized through my Shell.as class.
Heres my hiarchy of my class structure.
here are my classes in order Shell.as,Interface.as, and LatestWorks.as
Here is Shell.as class
Code: Select all
package net.schemagroup
import gs.*;
import gs.easing.*;
import flash.display.*;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.media.SoundLoaderContext;
import flash.media.SoundTransform;
import flash.events.*;
import flash.net.*;
import net.schemagroup.ui.Interface;
import net.schemagroup.LatestWorks;
public class Shell extends MovieClip
public var duration:Number;
public var swfWidth:uint;
public var swfHeight:uint;
private var mySound:Sound;
private var urlSound:String;
private var urlRequest:URLRequest;
private var soundBuffTime:Number;
private var sndChannel:SoundChannel;
private var testingSound:Boolean;
private var transform0:SoundTransform;
private var directoryPath:String;
private var latestPage:MovieClip;
var myWork:LatestWorks;
public function Shell()
soundBuffTime = 1000;
var myInterface:Interface = new Interface();
myInterface.revealInterface(interface_mc);
latestPage = pages_mc.page0_mc;
testingSound = true;
duration = 0.75;
if (testingSound)
directoryPath = "../ambient/";
urlSound = directoryPath + "06_Dabz_Beat.mp3";
else
directoryPath = "ambient/";
urlSound = directoryPath + "06_Dabz_Beat.mp3";
mySound = new Sound();
urlRequest = new URLRequest(urlSound);
var context:SoundLoaderContext = new SoundLoaderContext(soundBuffTime, true);
mySound.load(urlRequest, context);
sndChannel = mySound.play();
transform0 = sndChannel.soundTransform;
addEventListener(Event.ENTER_FRAME, onPosition);
myWork = new LatestWorks();
swfWidth = stage.stageWidth;
swfHeight = stage.stageHeight;
setDefaultStageSettings();
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.frameRate = 30;
stage.addEventListener(Event.RESIZE, resizeDisplay);
var myFullScreenSprite:Sprite = MovieClip(usability_controls_mc.fullscreen_mc);
myFullScreenSprite.buttonMode = true;
myFullScreenSprite.addEventListener(MouseEvent.CLICK, _handleClick);
pages_mc.page0_mc.title0_mc.mask = pages_mc.page0_mc.mask_mc;
pages_mc.page0_mc.scrollBox_mc.sb.mask = pages_mc.page0_mc.scrollBox_mc.maskscrollbar_mc;
private function goFullScreen():void
if (stage.displayState == StageDisplayState.NORMAL)
stage.displayState = StageDisplayState.FULL_SCREEN;
else
stage.displayState=StageDisplayState.NORMAL;
private function _handleClick(event:MouseEvent):void
trace("here!");
goFullScreen();
private function onPosition(e:Event):void
var soundPosition:uint = Math.ceil(Math.ceil(Math.abs(sndChannel.position))/Math.ceil(Math.abs(mySound.length)) * 100);
if (soundPosition == 90)
removeEventListener(Event.ENTER_FRAME, onPosition);
transform0.volume = 1;
TweenMax.to(sndChannel, 12, {volume:0});
var mySound2:Sound = new Sound();
var context2:SoundLoaderContext = new SoundLoaderContext(1000, true);
mySound2.load(new URLRequest(directoryPath + "14_Broken_Language.mp3"), context2);
var sndChannel2:SoundChannel = mySound2.play();
var transform:SoundTransform = sndChannel2.soundTransform;
transform.volume = 1;
TweenMax.from(sndChannel2, 12, {volume:0});
public function setDefaultStageSettings():void
pages_mc.page0_mc.scrollBox_mc.mask_content_mc.width = swfWidth;
pages_mc.page0_mc.bar6_mc.expandbar2_mc.width = swfWidth;
pages_mc.page0_mc.bar5_mc.expandbar_mc.width = swfWidth;
usability_controls_mc.x = swfWidth - usability_controls_mc.width;
usability_controls_mc.y = swfHeight - usability_controls_mc.height;
myWork.setStageHeight = swfHeight;
myWork.setStageWidth = swfWidth;
myWork.setupParameters(latestPage);
myWork.runInitAnimation();
trace("My stageWidth is: "+ myWork.setStageWidth);
trace("My stageHeight is: "+ myWork.setStageHeight);
pages_mc.y = swfHeight - 478;
trace("Pages y is: " + pages_mc.y);
public function resizeDisplay(e:Event):void
swfWidth = stage.stageWidth;
swfHeight = stage.stageHeight;
myWork.setStageHeight = swfHeight;
myWork.setStageWidth = swfWidth;
pages_mc.page0_mc.scrollBox_mc.mask_content_mc.width = swfWidth;
pages_mc.page0_mc.bar6_mc.expandbar2_mc.width = swfWidth;
pages_mc.page0_mc.bar5_mc.expandbar_mc.width = swfWidth;
usability_controls_mc.x = swfWidth - usability_controls_mc.width;
usability_controls_mc.y = swfHeight - usability_controls_mc.height;
pages_mc.y = uint(swfHeight - pages_mc.height);
Here is Interface.as class
Code: Select all
package net.schemagroup.ui
import gs.*;
import gs.easing.*;
import flash.events.*;
import flash.display.*;
import flash.utils.setTimeout;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.net.Socket;
import flash.text.AntiAliasType;
import flash.text.TextFieldAutoSize;
a
public class Interface extends MovieClip
private var duration:Number;
private var xml:XML;
private var movContainer:MovieClip;
private var movDropDownContainer:MovieClip;
private var myMenuArray:Array;
private var myMenuDropArray:Array;
private var newY:uint;
private var oldY:uint;
private var spacer:int;
private var timedProcess:int;
private var myMainDrop:DropItem;
public function Interface():void
duration = 0.75;
spacer = 12;
myMenuDropArray = [];
myMenuArray = [];
public function revealInterface(myContainer:MovieClip):void
trace("Revealing Interface!");
movContainer = myContainer;
movDropDownContainer = myContainer.container_mc;
var yArray:Array = [-10.0,6,105];
var delayArray:Array = [2,2.15,2.45];
TweenMax.to(movContainer.logo_mc, duration, {y:yArray[0], delay:delayArray[0], alpha:1,timeScale:1, ease:Strong.easeOut});
TweenMax.to(movContainer.bar0_mc, duration, {y:yArray[1], delay:delayArray[1], alpha:1,timeScale:1, ease:Strong.easeOut});
TweenMax.to(movContainer.bar1_mc, duration, {y:yArray[2], delay:delayArray[2], alpha:1,timeScale:1, ease:Strong.easeOut, onComplete:loadXML});
private function loadXML():void
var testingSound = true;
var xmlPath:String;
if (testingSound)
xmlPath = "../xml/interface.xml";
else
xmlPath = "xml/interface.xml";
var xmlURLRequest:URLRequest = new URLRequest(xmlPath);
var xmlURLLoader:URLLoader = new URLLoader(xmlURLRequest);
xmlURLLoader.addEventListener(Event.COMPLETE, onComplete);
private function onComplete(e:Event):void
xml = new XML(e.target.data);
//trace(xml);
if (xml != null)
buildInterface(xml);
else
trace("XML did not load successfully!");
private function buildInterface(e:XML):void
var xmlLength:uint = e.menu.section.page.length();
var xmlLength2:uint = e.dropdown.section.item.length();
//trace("XMLength is: "+ xmlLength);
var xmlList:XMLList = new XMLList(e.menu.section.page);
var xmlList2:XMLList = new XMLList(e.dropdown.section.item);
myMainDrop = new DropItem();
myMainDrop.mainDrop_mc.txt.text = e.dropdown.section.attribute("title");
myMainDrop.mainDrop_mc.txt.autoSize = TextFieldAutoSize.LEFT;
myMainDrop.mainDrop_mc.txt.antiAliasType = AntiAliasType.ADVANCED;
myMainDrop.alpha = 0;
myMainDrop.y = int(Math.round(myMainDrop.height / 2));
myMainDrop.buttonMode = true;
myMainDrop.mouseChildren = false;
myMainDrop.addEventListener(MouseEvent.CLICK, dropDown);
var yArray:Array = [0,spacer * 2];
TweenMax.to(myMainDrop, duration, {y:int(spacer), alpha:1, ease:Strong.easeOut});
movContainer.dropcontainer_mc.addChild(myMainDrop);
oldY = uint(movContainer.dropcontainer_mc.y + - spacer);
for (var i:uint = 0; i < xmlLength; i++)
//trace(xmlList[i].title);
var myItem:MenuItem = new MenuItem();
myItem.myText_mc.txt.htmlText = xmlList[i].title.toString();
myItem.myText_mc.txt.autoSize = TextFieldAutoSize.LEFT;
myItem.myText_mc.txt.antiAliasType = AntiAliasType.ADVANCED;
myItem.y = int(myItem.height + spacer) * i;
myItem.alpha = 0;
myMenuArray.push(myItem);
var setDynamicDelay = Number("0." + 1) * i;
trace(setDynamicDelay);
myItem.mouseChildren = false;
myItem.buttonMode = true;
myItem.addEventListener(MouseEvent.CLICK, selectedPage);
TweenMax.to(myItem, duration, {y:yArray[i], alpha:1, delay:setDynamicDelay, ease:Strong.easeOut});
movContainer.container_mc.addChild(myItem);
for (var j:uint = 0; j < xmlLength2; j++)
//trace(xmlList[i].title);
var dropItem:MenuItem = new MenuItem();
dropItem.myText_mc.txt.text = xmlList2[j].title.toString();
dropItem.myText_mc.txt.autoSize = TextFieldAutoSize.LEFT;
dropItem.myText_mc.txt.antiAliasType = AntiAliasType.ADVANCED;
dropItem.y = int(spacer) * j;
dropItem.x = int(spacer);
myMainDrop.container_mc.y = - int(myMainDrop.container_mc.height);
newY = myMainDrop.container_mc.y;
myMenuDropArray.push(dropItem);
dropItem.buttonMode = true;
dropItem.mouseChildren = false;
dropItem.addEventListener(MouseEvent.CLICK, selectedPage);
myMainDrop.mask_mc.height = myMainDrop.container_mc.height;
movDropDownContainer.addChild(dropItem);
if(j >= xmlLength2-1)
//timedProcess = setTimeout(revealDropDown, 400);
private function dropDown(e:MouseEvent):void
revealDropDown();
private function selectedPage(e:MouseEvent):void
public function revealDropDown():void
TweenMax.to(movDropDownContainer, 1, {y:200, ease:Strong.easeOut});
TweenMax.to(myMenuArray[1], 1, {y:movDropDownContainer.height + spacer + spacer/2, ease:Strong.easeOut});
Here is LatestWorks.as class
Code: Select all
package net.schemagroup
import gs.*;
import gs.easing.*;
import flash.events.*;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.geom.Rectangle;
import flash.net.Socket;
import flash.display.*;
import flash.utils.*;
import flash.filters.BlurFilter;
import flash.text.AntiAliasType;
import flash.text.TextFieldAutoSize;
import net.schemagroup.ui.Interface;
public class LatestWorks extends Interface {
private var currentCount:uint;
private var setDelays:Array;
private var imageTarget:Array;
private var myXCordBoxArray:Array;
private var myYCordBoxArray:Array;
private var setBlurX:Array;
private var setBlurY:Array;
private var setTimeScale:Number;
private var setDuration:Number;
private var passXMLength:Number;
private var imageRatio:Number;
private var xmlPath:String;
private var timedProcess:Number;
private var xmlLength:int;
private var xmlLength2:int;
private var xmlURLRequest:URLRequest;
private var xmlURLLoader:URLLoader;
private var xml:XML;
private var categorySelector:uint;
private static var spacer:int=10;
private var passMask:Sprite;
private var passScrollBar:MovieClip;
private var projectItemURL:Array;
public var catButtonsArray:Array;
public var passContainer:MovieClip;
public var whatState:Boolean;
private var imageDirectory:String;
private var counter:Number;
private var projectImageWidth:Number;
private var testingXML:Boolean;
public var btnClicked:Boolean;
private var passedArray:Array;
public var scrollBarWidth:Number;
public var whatCategory:int;
public var increment:int;
public var increment2:int;
private var swfWidth:int;
private var swfHeight:int;
private var projectsLoaded:Boolean;
private static const tintColor:int=0x0180AA;
public var mainObject:MovieClip;
private var myInterface:MovieClip;
private var myThumbContainer:DisplayObjectContainer;
private var someInterface:Interface;
public function LatestWorks():void
this.projectsLoaded=false;
this.increment=0;
this.increment2=0;
this.catButtonsArray=[];
testingXML=true;
if (testingXML) {
imageDirectory="../images/";
xmlPath="../xml/portfolio.xml";
} else {
imageDirectory="images/";
xmlPath="xml/portfolio.xml";
public function setupParameters(latestPage:MovieClip):void {
this.mainObject = latestPage;
this.passScrollBar= mainObject.scrollBox_mc.sb.scrollbar_mc;
this.passMask= mainObject.mask_mc;
this.passContainer= mainObject.scrollBox_mc.content_mc;
counter=30;
setBlurX = [5,
5,
5,
0,
150,
150,
10];
setBlurY = [10,
10,
10,
10,
150,
150,
0];
myXCordBoxArray = [-260,
-55,
-147,
271,
289,
this.swfWidth+577,
this.swfWidth+368];
myYCordBoxArray = [this.swfHeight + -50,
this.swfHeight + -167,
this.swfHeight + -309,
this.swfHeight + 72,
this.swfHeight + 72,
this.swfHeight + 142,
72];
setDelays=[0,0.35,0.55,0.75,0.95,1.15,1.35,1.45];
setTimeScale=2;
this.mainObject.categoryHolder_mc.mask = this.mainObject.mask_category_mc;
setDuration=0.75;
public function runInitAnimation():void {
var objectLength:uint = 7;
for (var i:int = 0; i < objectLength; i++) {
var myMC:DisplayObject = this.mainObject["bar"+i+"_mc"];
//trace("Counter is: " + i + " " + myMC.name + " Ycord is: "+ myYCordBoxArray[i]);
TweenMax.from(myMC, setDuration, {blurFilter:{blurX:setBlurX[i],
blurY:setBlurX[i]},
x:myXCordBoxArray[i],
y:myYCordBoxArray[i],
delay:setDelays[i],
timescale:Math.random() * setTimeScale,
ease:Back.easeInOut});
if (i>=4) {
TweenMax.from(mainObject.bar5_mc, setDuration, {blurFilter:{blurX:setBlurX[5],
blurY:setBlurY[5]},
x:myXCordBoxArray[5],
delay:setDelays[5],
ease:Strong.easeOut});
TweenMax.from(mainObject.bar6_mc, setDuration, {blurFilter:{blurX:setBlurX[6],
blurY:setBlurX[6]},
x:myXCordBoxArray[6],
delay:setDelays[6],
ease:Strong.easeOut});
TweenMax.to(this.passMask, setDuration, {scaleX:1, delay:2, ease:Strong.easeOut, onStart:AssignXMLSettings});
break;
public function AssignXMLSettings():void {
xmlURLRequest=new URLRequest(xmlPath);
xmlURLLoader=new URLLoader(xmlURLRequest);
xmlURLLoader.addEventListener(Event.COMPLETE, onLoaded);
public function onLoaded(e:Event):void {
xml=new XML(e.target.data);
if (xml.data!=null) {
trace(xmlPath + " successfully loaded!");
buildPortfolio(xml);
buildCatMenu(xml);
TweenMax.to(mainObject.categoryHolder_mc, 0.75, {y:221, ease:Strong.easeOut});
TweenMax.to(mainObject.scrollBox_mc.maskscrollbar_mc, setDuration, {scaleX:1, ease:Strong.easeOut});
} else {
trace(xmlPath + " did not load successfully!");
public function buildCatMenu(e:XML):void {
var xmlList:XMLList=e.category.items.catitem;
xmlLength2=xmlList.length();
var XPos:int=0;
var myCatMain:CatItem = new CatItem();
myCatMain.category_txt.htmlText=e.category.@main;
myCatMain.category_txt.autoSize=TextFieldAutoSize.LEFT;
myCatMain.category_txt.antiAliasType=AntiAliasType.ADVANCED;
mainObject.categoryHolder_mc.addChild(myCatMain);
var TextValue:int=myCatMain.width;
for (var i:uint = 0; i < xmlLength2; i++) {
var myCatItem:CatItem = new CatItem();
myCatItem.category_txt.htmlText=xmlList[i].title;
myCatItem.category_txt.autoSize=TextFieldAutoSize.LEFT;
myCatItem.category_txt.antiAliasType=AntiAliasType.ADVANCED;
myCatItem.btnClicked=xmlList[i].@setDefault;
myCatItem.whatCategory=i;
//trace(xmlList[i].@setState);
myCatItem.x=TextValue;
XPos=myCatItem.width;
catButtonsArray.push(myCatItem);
TextValue+=Number(spacer+XPos);
mainObject.categoryHolder_mc.addChild(myCatItem);
myCatItem.buttonMode=true;
myCatItem.mouseChildren=false;
myCatItem.addEventListener(MouseEvent.CLICK, catClick);
myCatItem.addEventListener(MouseEvent.MOUSE_OVER, catOver);
myCatItem.addEventListener(MouseEvent.MOUSE_OUT, catOut);
if (catButtonsArray[i].btnClicked==true) {
catButtonsArray[i].buttonMode=false;
catButtonsArray[i].mouseEnabled=false;
TweenMax.to(catButtonsArray[i], 1, {tint:tintColor, delay:0.45, ease:Strong.easeOut});
private function catClick(e:MouseEvent):void {
var myButton:MovieClip=MovieClip(e.currentTarget);
if(projectsLoaded)
projectsLoaded = false;
myButton.buttonMode=false;
myButton.mouseEnabled=false;
TweenMax.to(myButton, 1, {tint:tintColor, ease:Strong.easeOut});
categorySelector = myButton.whatCategory;
removeItems();
validateCategories();
myButton.btnClicked=true;
changeTitle(myButton.category_txt.text);
public function removeItems():void {
//trace("Remove items fired!");
var setDynamicDelay:Number;
for (var i:int = 0; i < xmlLength; i++)
setDynamicDelay = Number("0."+ 1) * i;
var myItem:MovieClip = imageTarget[i];
//trace(myItem.name);
//trace("RemoveItem count is: "+ i + " out of " + Number(xmlLength-1));
TweenMax.to(myItem, 1, {blurFilter:{blurY:50},
y:this.swfHeight - myItem.height,
ease:Strong.easeOut,
delay:setDynamicDelay,
onComplete:removeTarget,
ease:Strong.easeOut});
public function removeTarget():void {
increment++;
//trace("Increment is: "+ increment);
this.passContainer.removeChildAt(0);
if (increment >= Number(xmlLength))
increment = 0;
//trace("Increment is: "+ increment);
//trace("Increment is equal to: "+ Number(xmlLength-1));
buildPortfolio(xml);
private function validateCategories():void {
for (var i:int = 0; i < xmlLength2; i++)
if (catButtonsArray[i].btnClicked==true)
TweenMax.to(catButtonsArray[i], 1, {removeTint:true, ease:Strong.easeOut});
catButtonsArray[i].buttonMode=true;
catButtonsArray[i].mouseEnabled=true;
catButtonsArray[i].btnClicked=false;
private function changeTitle(e:String):void {
TweenMax.to(mainObject.mask_mc, 0.75, {scaleX:0, ease:Strong.easeOut, onComplete:loadTitle, onCompleteParams:[e]});
private function loadTitle(e:String) {
mainObject.title0_mc.title_txt.htmlText=e;
if(e == "WEBSITES")
TweenMax.to(mainObject.title0_mc, 0.75, {x:120, delay:0.45, ease:Strong.easeOut});
TweenMax.to(mainObject.bar6_mc, 0.75, {x:550, delay:0.45, ease:Strong.easeOut});
TweenMax.to(mainObject.mask_mc, 0.75, {scaleX:1, delay:0.45, ease:Strong.easeOut});
}else{
TweenMax.to(mainObject.title0_mc, 0.75, {x:226, delay:0.45, ease:Strong.easeOut});
TweenMax.to(mainObject.bar6_mc, 0.75, {x:656, delay:0.45, ease:Strong.easeOut});
TweenMax.to(mainObject.mask_mc, 0.75, {scaleX:1, delay:0.45, ease:Strong.easeOut});
public function buildPortfolio(e:XML):void
trace("Building Portfolio!");
//trace("XML category is: " + categorySelector);
var xmlList:XMLList=e.projectitem[categorySelector].item;
xmlLength=xmlList.length();
//trace("Length of section is: " + xmlLength);
var itemGap:Number=20;
var setDynamicDelay:Number;
currentCount=0;
passXMLength=Number(xmlLength);
var imageRatio:uint=passXMLength/passXMLength;
//trace("Image ratio is: " + imageRatio);
imageTarget=[];
projectItemURL=[];
for (var i:uint = 0; i < xmlLength; i++)
/*trace("-----------------------------------");
trace("Client is: " + xmlList[i].client);
trace("Description is: " + xmlList[i].description);
trace("Platform is: " + xmlList[i].platform);
trace("Launch is: " + xmlList[i].launch);
trace("-----------------------------------");
var myItem:ProjectItem = new ProjectItem();
myItem.name="item"+i+"_mc";
myItem.x=Number(myItem.width+itemGap)*i;
myItem.y=Number(this.swfHeight/2 - myItem.height);
projectImageWidth=Number(myItem.width+itemGap)*i;
//trace("Project image width is: " + projectImageWidth);
this.passContainer.addChild(myItem);
imageTarget.push(myItem);
//trace(imageTarget[i].name);
myItem.text_mc.description_txt.htmlText = xmlList[i].description.toString();
myItem.text_mc.description_txt.wordWrap = true;
myItem.text_mc.description_txt.autoSize = TextFieldAutoSize.LEFT;
myItem.text_mc.description_txt.antiAliasType = AntiAliasType.ADVANCED;
projectItemURL.push(imageDirectory + xmlList[i].attributes());
setDynamicDelay = Number("0."+1)*i;
TweenMax.to(myItem, 0.75, {blurFilter:{blurY:50}});
TweenMax.to(myItem, 0.75, {blurFilter:{blurY:0}, y:0, delay:setDynamicDelay, ease:Strong.easeOut});
if (i == xmlLength-1) {
trace("Preloading images!");
//preloadImages(projectItemURL,imageTarget);
preloadImages();
timedProcess = setTimeout(initRevealDropDown, 10000);
this.passScrollBar.width=Number(myItem.width+itemGap/imageRatio);
public function initRevealDropDown():void
clearTimeout(timedProcess);
someInterface = new Interface();
someInterface.revealDropDown();
private function preloadImages() {
var loaderURLRequest:URLRequest=new URLRequest(projectItemURL[currentCount]);
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.OPEN, _onOpen);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, _onProgress);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, _handleImageLoaded);
loader.load(loaderURLRequest);
private function _onOpen(e:Event):void {
//trace("loading started!");
imageTarget[currentCount].preloader_mc.gotoAndPlay("play");
private function _onProgress(e:ProgressEvent):void {
var loadBytes:Number=e.target.bytesLoaded;
var totalBytes:Number=e.target.bytesTotal;
var percent:Number=Math.ceil(loadBytes/totalBytes*100);
//trace("BytesLoaded: " + loadBytes + " out of " + totalBytes + " Percentage: " + percent);
imageTarget[currentCount].preloader_mc.percent_mc.pct_txt.text=Math.ceil(loadBytes/totalBytes*10).toString();
private function _handleImageLoaded(e:Event):void {
//trace("Finished loading: " + e.target.url);
imageTarget[currentCount].preloader_mc.percent_mc.pct_txt.text="";
imageTarget[currentCount].container_mc.alpha=0;
imageTarget[currentCount].container_mc.addChild(Bitmap(e.target.content));
imageTarget[currentCount].preloader_mc.stop();
TweenMax.to(imageTarget[currentCount].preloader_mc, 0.75, {alpha:0, ease:Strong.easeOut});
TweenMax.to(imageTarget[currentCount].container_mc, 0.75, {alpha:1, ease:Strong.easeOut});
if (currentCount<passXMLength-1)
currentCount++;
preloadImages();
}else if(currentCount >= passXMLength-1)
//trace("Current count is equal to xmlLength!");
projectsLoaded = true;
//trace("ProjectsLoaded is: "+ projectsLoaded);
private function catOver(e:MouseEvent):void {
var myButton:MovieClip=MovieClip(e.currentTarget);
TweenMax.to(myButton, 1, {tint:tintColor, ease:Strong.easeOut});
private function catOut(e:MouseEvent):void {
var myButton:MovieClip=MovieClip(e.currentTarget);
if (myButton.btnClicked!=true) {
TweenMax.to(myButton, 1, {removeTint:true, ease:Strong.easeOut});
public function get selectCategory():uint {
return this.categorySelector;
public function set selectCategory(e:uint):void {
this.categorySelector=e;
public function get getState():Boolean {
return this.whatState;
public function set getState(setState:Boolean):void {
this.whatState=setState;
public function get setStageHeight():int
return swfHeight;
public function set setStageHeight(whatHeight:int):void
swfHeight = whatHeight;
public function get setStageWidth():int
return swfWidth;
public function set setStageWidth(whatWidth:int):void
swfWidth = whatWidth;
Please anybody, it would be very helpful since i'm still trying to tackle as3 classes.
thanks
abeso, movDropDownContainer (which i know is myContainer.container_mc) doesn't exist WHEN revealDropDown() is called (and that error message is displayed).
we already know it does exist and movDropDownContainer is defined correctly when your constructor is called so some time after that the timeline that contains myContainer.container_mc must move and it no longer exists or actionscript is used to remove the movieclip.
the most subtle way that can happen is with a timeline created instance (ie, created in the ide). there are lots of ways this can happen. obviously, if you see that your timeline moves to or through a frame where myContainer.container_mc doesn't exist, it should be clear why you're seeing that error message. but this error can be caused by more difficult to understand situations.
for example, if it appears that movieclip is in every frame but it's in a layer with more than 1 keyframe, then you can have identically named instances (and that all look the same) that are not the same instance. in fact, the only sure way to know that movieclip exists in keyframes where it appears to exist is to clear all the keyframes in its layer (after the first keyframe where it appears) and then create all the additional keyframes. at that point, if you do not remove the movieclip from the stage, in any keyframes, all the instances will be the same. if you do anything else or you've done anything else, you're going to run into this problem. -
TypeError: Error #1009
I gave up on trying to export my Movie Clip like I was asking in my previous post. :'( So i decided to make the the project interactive. My idea is based on a DVD menu with a scene selections button that leads to a screen on a different layer on a different frame. I put the .fla file on my website at www.leetclanforall.com/flash/ If you download it and take a look at it it would help you to understand the following problems:
1) This cryptic error message:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Roof_Scene_fla::MainTimeline/frame1()
2) My Scene Selection and Link buttons don't work.
3) When I try to use gotoAndStop(2); in order to stop at the menu screen, it gives me a white screen and I can't fathom why.
Just know that I am a beginner and my animation is very crappy. It doesn't have to be high quality animation, but the interactiveness and professional quality of the menu system is a project grade. My grade is currently a 93, but I'd like to get it higher with this project. The whole thing is worth twelve grades. :/ I need to do well on this. I have spent about 5 days of my life working on this...
Any and all help is appreciated, thanks in advance,
Darth HaxorroofScene_btn.addEventListener(MouseEvent.CLICK,click1);
But I no longer needed that button so I just (like right before posting this) commented out that line. Now it says the same thing but for this line:
main_screen_button_selections.addEventListener(MouseEvent.CLICK,click5); -
TypeError: Error #1009 A.S 3.0
Sorry i am bad in English...In this case, I'm still new.I have this error
"TypeError: Error #1009: Cannot access a property or method of a null object reference. at Monster/hurtPlayer() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at fl.motion::AnimatorBase/end() at fl.motion::AnimatorBase/handleLastFrame()
This my code:
var monstersInGame:uint;
var monsterMaker:Timer;
var container_mc:MovieClip;
var cursor:MovieClip;
var winning:wins = new wins();
var gameovers:gameover = new gameover();
var livecherep:liveimg = new liveimg();
var score:int; var energy:int;
var live:Number =3;
var myTimer2:Timer;
var myTimer3:Timer;
var monster:MovieClip; function startlevel(); {container_mc = new MovieClip(); addChild(container_mc); energy = energy_mc.totalFrames; energy_mc.gotoAndStop(energy); if(live==3){ lives.gotoAndStop(3);} if(live==2){ lives.gotoAndStop(2);} if(live==1){ lives.gotoAndStop(1);} monstersInGame = 8; monsterMaker = new Timer(1000,monstersInGame); monsterMaker.addEventListener(TimerEvent.TIMER, createMonsters); monsterMaker.start(); cursor = new Cursor(); addChild(cursor); Mouse.hide (); stage.addEventListener(MouseEvent.MOUSE_MOVE, dragCursor); score = 0; } function dragCursor(event:MouseEvent):void { cursor.x = this.mouseX; cursor.y = this.mouseY; } function createMonsters(event:TimerEvent):void { monster = new Monster(); monster.x = Math.random() * stage.stageWidth; if (monster.x <= 100) { monster.x = 100; } else if (monster.x >= 380) { monster.x = 350; } monster.y = Math.random() * stage.stageHeight; if (monster.y <= 100) { monster.y = 100; } else if (monster.y >= 380) { monster.y = 350; } container_mc.addChild(monster); } function nextf(event:TimerEvent) // timer for winning { myTimer2.removeEventListener(TimerEvent.TIMER_COMPLETE,nextf); removeChild(winning) gotoAndStop(4); } function nextm(event:TimerEvent) // timer for gameover { myTimer3.removeEventListener(TimerEvent.TIMER_COMPLETE,nextm); removeChild(gameovers) gotoAndStop(13); } function increaseScore():void //if win { score ++; if(score >= 6) { monsterMaker.stop(); removeChild(container_mc); removeChild(cursor) stage.removeEventListener(MouseEvent.MOUSE_MOVE, dragCursor); addChild(winning) myTimer5 = new Timer(1000,1); myTimer5.addEventListener(TimerEvent.TIMER_COMPLETE,nextf); myTimer5.start(); } } function decreaseEnergy():void // if lose { energy --; if(energy==4){ energy_mc.gotoAndStop(4);} if(energy==3){ energy_mc.gotoAndStop(3);} if (energy==2){ energy_mc.gotoAndStop(2);} if(energy==1){ energy_mc.gotoAndStop(1);} if(energy==0){ energy_mc.gotoAndStop(1);} if(energy <= 1) { live--; monsterMaker.stop(); removeChild(container_mc); removeChild(cursor) Mouse.show(); stage.removeEventListener(MouseEvent.MOUSE_MOVE, dragCursor); if (live==0) { addChild(gameovers) myTimer6 = new Timer(1500,1); myTimer6.addEventListener(TimerEvent.TIMER_COMPLETE,nextm); myTimer6.start(); } else { gotoAndStop(9); } } } [/HIGHLIGHT] but this code i am have in MovieClip monster : [HIGHLIGHT] import fl.motion.Animator; import fl.motion.MotionEvent; var this_xml:XML =
; var this_animator:Animator = new Animator(this_xml, this); this_animator.play(); this_animator.addEventListener(MotionEvent.MOTION_END, hurtPlayer); function hurtPlayer (Event:MotionEvent): void { var main:MovieClip = MovieClip(this.parent.parent); main.decreaseEnergy(); this.parent.removeChild(this); } this.addEventListener(MouseEvent.CLICK, killMonster); function killMonster(event:MouseEvent):void { gotoAndPlay(31) ; this_animator = new Animator(this_xml, this); this_animator.play(); this_animator.addEventListener(MotionEvent.MOTION_END, die); } function die(event:MotionEvent):void { var main:MovieClip = MovieClip(this.parent.parent); main.increaseScore(); this_animator.removeEventListener(MotionEvent.MOTION_END, hurtPlayer) this.parent.removeChild(this); } [/HIGHLIGHT]
As I understand it, the error is in the function hurtPlayer at monster movieclip .I am ran Debug movie, showed on main.decreaseEnergy(); in hurtPlayer function.Please help me.Thanks.This code i have in mine timeline first frame:
var monstersInGame:uint;
var monsterMaker:Timer;
var container_mc:MovieClip;
var cursor:MovieClip;
var winning:wins = new wins();
var gameovers:gameover = new gameover();
var livecherep:liveimg = new liveimg();
var score:int;
var energy:int;
var live:Number =3;
var myTimer2:Timer;
var myTimer3:Timer;
var monster:MovieClip;
function startlevel();
container_mc = new MovieClip();
addChild(container_mc);
energy = energy_mc.totalFrames;
energy_mc.gotoAndStop(energy);
if(live==3){ lives.gotoAndStop(3);}
if(live==2){ lives.gotoAndStop(2);}
if(live==1){ lives.gotoAndStop(1);}
monstersInGame = 8;
monsterMaker = new Timer(1000,monstersInGame);
monsterMaker.addEventListener(TimerEvent.TIMER, createMonsters);
monsterMaker.start();
cursor = new Cursor();
addChild(cursor);
Mouse.hide ();
stage.addEventListener(MouseEvent.MOUSE_MOVE, dragCursor);
score = 0;
function dragCursor(event:MouseEvent):void
cursor.x = this.mouseX;
function createMonsters(event:TimerEvent):void
monster = new Monster();
monster.x = Math.random() * stage.stageWidth;
if (monster.x <= 100)
monster.x = 100;
else if (monster.x >= 380)
monster.x = 350;
monster.y = Math.random() * stage.stageHeight;
if (monster.y <= 100)
monster.y = 100;
else if (monster.y >= 380)
monster.y = 350;
container_mc.addChild(monster);
function nextf(event:TimerEvent) // timer for winning
myTimer2.removeEventListener(TimerEvent.TIMER_COMPLETE,nextf);
removeChild(winning) gotoAndStop(4);
function nextm(event:TimerEvent) // timer for gameover
myTimer3.removeEventListener(TimerEvent.TIMER_COMPLETE,nextm);
removeChild(gameovers)
gotoAndStop(13);
function increaseScore():void //if win
score ++;
if(score >= 6)
monsterMaker.stop();
removeChild(container_mc);
removeChild(cursor)
stage.removeEventListener(MouseEvent.MOUSE_MOVE, dragCursor);
addChild(winning)
myTimer5 = new Timer(1000,1);
myTimer5.addEventListener(TimerEvent.TIMER_COMPLETE,nextf);
myTimer5.start();
function decreaseEnergy():void //if lose
energy --;
if(energy==4){ energy_mc.gotoAndStop(4);}
if(energy==3){ energy_mc.gotoAndStop(3);}
if (energy==2){ energy_mc.gotoAndStop(2);}
if(energy==1){ energy_mc.gotoAndStop(1);}
if(energy==0){ energy_mc.gotoAndStop(1);}
if(energy <= 1)
live--;
monsterMaker.stop();
removeChild(container_mc);
removeChild(cursor)
Mouse.show();
stage.removeEventListener(MouseEvent.MOUSE_MOVE, dragCursor);
if (live==0)
addChild(gameovers)
myTimer6 = new Timer(1500,1); myTimer6.addEventListener(TimerEvent.TIMER_COMPLETE,nextm);
myTimer6.start();
else
gotoAndStop(9);
This code i have in MovieClip monster:
import fl.motion.Animator;
import fl.motion.MotionEvent;
var this_xml:XML = HERE I inserted the classic tween code with the instance name "this" to use in the ActionScript
Sorry i am cant insert there this classic tween code
var this_animator:Animator = new Animator(this_xml, this);
this_animator.play();
this_animator.addEventListener(MotionEvent.MOTION_END, hurtPlayer);
function hurtPlayer (Event:MotionEvent): void
var main:MovieClip = MovieClip(this.parent.parent);
main.decreasyEnergy(); in this line i am have error
"TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Monster/hurtPlayer()[Monster::frame1:35]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at fl.motion::AnimatorBase/end()
at fl.motion::AnimatorBase/handleLastFrame()
at fl.motion::AnimatorBase/nextFrame()
at fl.motion::AnimatorBase/handleEnterFrame()"
this.parent.removeChild(this);
this.addEventListener(MouseEvent.CLICK, killMonster);
function killMonster(event:MouseEvent):void
gotoAndPlay(31)
this_animator = new Animator(this_xml, this);
this_animator.play();
this_animator.addEventListener(MotionEvent.MOTION_END, die);
function die(event:MotionEvent):void
var main:MovieClip = MovieClip(this.parent.parent);
main.increaseScore();
this_animator.removeEventListener(MotionEvent.MOTION_END, hurtPlayer);
this.parent.removeChild(this); -
Hi all,
I am new to ActionScript and Flash, and I am getting this error: TypeError: Error #1009: Cannot access a property or method of a null object reference.
at jessicaclucas_fla::MainTimeline/stopResumescroll()
I have several different clips in one movie that have scrolling content. When I click a button to move to a different clip that doesn’t have a certain scroll, it gives me this error. I cannot figure out how to fix this. You can see the site I am working on: http://www.jessicaclucas.com. I would really appreciate some help! Thank you in advance. Here is the code:
//Import TweenMax and the plugin for the blur filter
import gs.TweenMax;
import gs.plugins.BlurFilterPlugin;
//Save the content’s and mask’s height.
//Assign your own content height here!!
var RESUMECONTENT_HEIGHT:Number = 1500;
var RESUME_HEIGHT:Number = 450;
//We want to know what was the previous y coordinate of the content (for the animation)
var oldResumeY:Number = myResumecontent.y;
//Position the content on the top left corner of the mask
myResumecontent.x = myResume.x;
myResumecontent.y = myResume.y;
//Set the mask to our content
myResumecontent.mask = myResume;
//Create a rectangle that will act as the Resumebounds to the scrollMC.
//This way the scrollMC can only be dragged along the line.
var Resumebounds:Rectangle = new Rectangle(resumescrollMC.x,resumescrollMC.y,0,450);
//We want to know when the user is Resumescrolling
var Resumescrolling:Boolean = false;
//Listen when the user is holding the mouse down on the scrollMC
resumescrollMC.addEventListener(MouseEvent.MOUSE_DOWN, startResumescroll);
//Listen when the user releases the mouse button
stage.addEventListener(MouseEvent.MOUSE_UP, stopResumescroll);
//This function is called when the user is dragging the scrollMC
function startResumescroll(e:Event):void {
//Set Resumescrolling to true
Resumescrolling = true;
//Start dragging the scrollMC
resumescrollMC.startDrag(false,Resumebounds);
//This function is called when the user stops dragging the scrollMC
function stopResumescroll(e:Event):void {
//Set Resumescrolling to false
Resumescrolling = false;
//Stop the drag
resumescrollMC.stopDrag();
//Add ENTER_FRAME to animate the scroll
addEventListener(Event.ENTER_FRAME, enterResumeHandler);
//This function is called in each frame
function enterResumeHandler(e:Event):void {
//Check if we are Resumescrolling
if (Resumescrolling == true) {
//Calculate the distance how far the scrollMC is from the top
var distance:Number = Math.round(resumescrollMC.y - Resumebounds.y);
//Calculate the percentage of the distance from the line height.
//So when the scrollMC is on top, percentage is 0 and when its
//at the bottom the percentage is 1.
var percentage:Number = distance / RESUME_HEIGHT;
//Save the old y coordinate
oldResumeY = myResumecontent.y;
//Calculate a new y target coordinate for the content.
//We subtract the mask’s height from the contentHeight.
//Otherwise the content would move too far up when we scroll down.
//Remove the subraction to see for yourself!
var targetY:Number = -((RESUMECONTENT_HEIGHT - RESUME_HEIGHT) * percentage) + myResume.y;
//We only want to animate the scroll if the old y is different from the new y.
//In our movie we animate the scroll if the difference is bigger than 5 pixels.
if (Math.abs(oldResumeY - targetY) > 5) {
//Tween the content to the new location.
//Call the function ResumetweenFinished() when the tween is complete.
TweenMax.to(myResumecontent, 0.3, {y: targetY, blurFilter:{blurX:22, blurY:22}, onComplete: ResumetweenFinished});
//This function is called when the tween is finished
function ResumetweenFinished():void {
//Tween the content back to “normal” (= remove blur)
TweenMax.to(myResumecontent, 0.3, {blurFilter:{blurX:0, blurY:0}});Hi again,
Thank you for helping. I really appreciate it! Would it be easier to say, if resumescrollMC exists, then execute these functions? I was not able to figure out the null statement from your post. Here is what I am trying (though I am not sure it is possible). I declared the var resumescrollMC, and then I tried to put pretty much the entire code into an if (resumescrollMC == true) since this code only needs to be completed when resumescrollMC is on the stage. It is not working the way I have tried, but I am assuming I am setting up the code incorrectly. Or, an if statement is not supposed to be issued to an object:
//Import TweenMax and the plugin for the blur filter
import gs.TweenMax2;
import gs.plugins.BlurFilterPlugin2;
//Save the content's and mask's height.
//Assign your own content height here!!
var RESUMECONTENT_HEIGHT:Number = 1500;
var RESUME_HEIGHT:Number = 450;
var resumescrollMC:MovieClip;
if (resumescrollMC == true) {
//We want to know what was the previous y coordinate of the content (for the animation)
var oldResumeY:Number = myResumecontent.y;
//Position the content on the top left corner of the mask
myResumecontent.x = myResume.x;
myResumecontent.y = myResume.y;
//Set the mask to our content
myResumecontent.mask = myResume;
//Create a rectangle that will act as the Resumebounds to the scrollMC.
//This way the scrollMC can only be dragged along the line.
var Resumebounds:Rectangle = new Rectangle(resumescrollMC.x,resumescrollMC.y,0,450);
//We want to know when the user is Resumescrolling
var Resumescrolling:Boolean = false;
//Listen when the user is holding the mouse down on the scrollMC
resumescrollMC.addEventListener(MouseEvent.MOUSE_DOWN, startResumescroll);
//Listen when the user releases the mouse button
stage.addEventListener(MouseEvent.MOUSE_UP, stopResumescroll);
//This function is called when the user is dragging the scrollMC
function startResumescroll(e:Event):void {
//Set Resumescrolling to true
Resumescrolling = true;
//Start dragging the scrollMC
resumescrollMC.startDrag(false,Resumebounds);
//This function is called when the user stops dragging the scrollMC
function stopResumescroll(e:Event):void {
//Set Resumescrolling to false
Resumescrolling = false;
//Stop the drag
resumescrollMC.stopDrag();
//Add ENTER_FRAME to animate the scroll
addEventListener(Event.ENTER_FRAME, enterResumeHandler);
//This function is called in each frame
function enterResumeHandler(e:Event):void {
//Check if we are Resumescrolling
if (Resumescrolling == true) {
//Calculate the distance how far the scrollMC is from the top
var distance:Number = Math.round(resumescrollMC.y - Resumebounds.y);
//Calculate the percentage of the distance from the line height.
//So when the scrollMC is on top, percentage is 0 and when its
//at the bottom the percentage is 1.
var percentage:Number = distance / RESUME_HEIGHT;
//Save the old y coordinate
oldResumeY = myResumecontent.y;
//Calculate a new y target coordinate for the content.
//We subtract the mask's height from the contentHeight.
//Otherwise the content would move too far up when we scroll down.
//Remove the subraction to see for yourself!
var targetY:Number = -((RESUMECONTENT_HEIGHT - RESUME_HEIGHT) * percentage) + myResume.y;
//We only want to animate the scroll if the old y is different from the new y.
//In our movie we animate the scroll if the difference is bigger than 5 pixels.
if (Math.abs(oldResumeY - targetY) > 5) {
//Tween the content to the new location.
//Call the function ResumetweenFinished() when the tween is complete.
TweenMax.to(myResumecontent, 0.3, {y: targetY, blurFilter:{blurX:22, blurY:22}, onComplete: ResumetweenFinished});
//This function is called when the tween is finished
function ResumetweenFinished():void {
//Tween the content back to "normal" (= remove blur)
TweenMax.to(myResumecontent, 0.3, {blurFilter:{blurX:0, blurY:0}}); -
Dear Sir,
I really need your valuable assistance i was about to finish a project but at very last moment i am stuck. Here is the explanation below...
I have two files called "holder.swf" and "slide.swf" i want to improt the "slide.swf" using this action below
var myLoader:Loader = new Loader();
var url:URLRequest = new URLRequest("slide.swf");
myLoader.load(url);
addChild(myLoader);
myLoader.x = 2;
myLoader.y = 2;
Also i have attached the flash file of "holder.swf". My concern is the moment i am calling the "slide.swf" inside the "holder.swf" it is showing the following error...
" TypeError: Error #1009: Cannot access a property or method of a null object reference.
at FC_Home_Ads_Holder_v2_fla::MainTimeline() "
Here are the files uploaded for your reference, please download this file http://www.touchpixl.com/ForumsAdobecom.zip
This error is being occured from "MainTimeline.as" file here is the code been use inside of this file below....
package FC_Home_Ads_Holder_v2_fla
import __AS3__.vec.*;
import adobe.utils.*;
import com.danehansen.*;
import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.plugins.*;
import flash.accessibility.*;
import flash.desktop.*;
import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.globalization.*;
import flash.media.*;
import flash.net.*;
import flash.net.drm.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.sensors.*;
import flash.system.*;
import flash.text.*;
import flash.text.engine.*;
import flash.text.ime.*;
import flash.ui.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class MainTimeline extends flash.display.MovieClip
public function MainTimeline()
new Vector.<String>(6)[0] = "Productivity";
new Vector.<String>(6)[1] = "Leadership";
new Vector.<String>(6)[2] = "Execution";
new Vector.<String>(6)[3] = "Education";
new Vector.<String>(6)[4] = "Speed of Trust";
new Vector.<String>(6)[5] = "Sales";
super();
addFrameScript(0, this.frame1);
return;
public function init():void
var loc1:*=null;
com.greensock.plugins.TweenPlugin.activate([com.greensock.plugins.Aut oAlphaPlugin]);
loc1 = new flash.net.URLLoader(new flash.net.URLRequest(this.XML_LOC));
var loc2:*;
this.next_mc.buttonMode = loc2 = true;
this.prev_mc.buttonMode = loc2;
stage.scaleMode = flash.display.StageScaleMode.NO_SCALE;
stage.align = flash.display.StageAlign.TOP_LEFT;
loc1.addEventListener(flash.events.Event.COMPLETE, this.xmlLoaded, false, 0, true);
this.prev_mc.addEventListener(flash.events.MouseEvent.CLICK, this.minusClick, false, 0, true);
this.next_mc.addEventListener(flash.events.MouseEvent.CLICK, this.plusClick, false, 0, true);
return;
public function xmlLoaded(arg1:flash.events.Event):void
var loc1:*=null;
var loc2:*=0;
this.xmlData = new XML(arg1.target.data);
loc2 = 0;
while (loc2 < this.LABELS.length)
loc1 = new Btn(this.LABELS[loc2], loc2);
this.btnHolder_mc.addChild(loc1);
this.BTNS.push(loc1);
trace(this.LABELS[loc2]);
++loc2;
this.current = uint(this.xmlData.@firstPick);
trace("-----width-----");
trace(this.contentMask.width);
var loc3:*=this.contentMask.width / this.LABELS.length;
trace(loc3);
loc2 = 0;
while (loc2 < this.BTNS.length)
this.BTNS[loc2].width = loc3;
this.BTNS[loc2].x = loc3 * loc2;
++loc2;
this.btnHolder_mc.addEventListener(flash.events.MouseEvent.CLICK, this.numClick, false, 0, true);
this.selectMovie();
return;
public function numClick(arg1:flash.events.MouseEvent):void
this.killTimer();
this.current = arg1.target.i;
this.selectMovie();
return;
public function killTimer():void
this.timerGoing = false;
if (this.timer)
this.timer.reset();
this.timer.addEventListener(flash.events.TimerEvent.TIMER, this.plusClick, false, 0, true);
this.timer = null;
return;
public function selectMovie():void
if (this.timerGoing)
this.timer = new flash.utils.Timer(uint(this.xmlData.ad[com.danehansen.MyMath.modulo(t his.current, this.xmlData.ad.length())].@delay), 1);
this.timer.start();
this.timer.addEventListener(flash.events.TimerEvent.TIMER, this.plusClick, false, 0, true);
while (this.holder_mc.numChildren > 0)
this.holder_mc.removeChild(this.holder_mc.getChildAt(0));
var loc1:*=new flash.display.Loader();
loc1.load(new flash.net.URLRequest(this.xmlData.ad[com.danehansen.MyMath.modulo(thi s.current, this.xmlData.ad.length())].@loc));
this.holder_mc.addChild(loc1);
var loc2:*=0;
while (loc2 < this.BTNS.length)
this.BTNS[loc2].deselect();
++loc2;
this.BTNS[com.danehansen.MyMath.modulo(this.current, this.xmlData.ad.length())].select();
var loc3:*=this.BTNS[com.danehansen.MyMath.modulo(this.current, this.xmlData.ad.length())].x + this.BTNS[com.danehansen.MyMath.modulo(this.current, this.xmlData.ad.length())].width / 2 + this.btnHolder_mc.x;
trace("addLength:" + this.xmlData.ad.length());
trace(loc3, com.danehansen.MyMath.modulo(this.current, this.xmlData.ad.length()));
com.greensock.TweenLite.to(this.indicator_mc, 0.3, {"x":loc3, "ease":com.greensock.easing.Cubic.easeOut});
loc1.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, this.adLoaded, false, 0, true);
return;
public function adLoaded(arg1:flash.events.Event):void
var evt:flash.events.Event;
var loc1:*;
evt = arg1;
try
evt.target.content.xmlData = this.xmlData.ad[com.danehansen.MyMath.modulo(this.current, this.xmlData.ad.length())];
catch (er:Error)
return;
public function minusClick(arg1:flash.events.MouseEvent):void
this.killTimer();
var loc1:*;
var loc2:*=((loc1 = this).current - 1);
loc1.current = loc2;
this.selectMovie();
return;
public function plusClick(arg1:flash.events.Event):void
if (arg1.type != "timer")
this.killTimer();
var loc1:*;
var loc2:*=((loc1 = this).current + 1);
loc1.current = loc2;
this.selectMovie();
trace("next");
return;
public function ENDED(arg1:flash.events.Event):void
if (arg1.type != "timer")
this.killTimer();
var loc1:*;
var loc2:*=((loc1 = this).current + 1);
loc1.current = loc2;
this.selectMovie();
trace("next");
return;
public function STARTED(arg1:flash.events.Event):void
this.killTimer();
return;
function frame1():*
this.timerGoing = true;
addEventListener("endNow", this.ENDED, false, 0, true);
addEventListener("startNow", this.STARTED, false, 0, true);
this.init();
return;
public const XML_LOC:String=stage.loaderInfo.parameters.xmlLoc ? stage.loaderInfo.parameters.xmlLoc : "home_ads.xml";
public const LABELS:__AS3__.vec.Vector.<String>=new Vector.<String>(6);
public const BTNS:__AS3__.vec.Vector.<Btn>=new Vector.<Btn>();
public const TRANSITION_TIME:Number=0.2;
public var contentMask:flash.display.MovieClip;
public var btnHolder_mc:flash.display.MovieClip;
public var holder_mc:flash.display.MovieClip;
public var indicator_mc:flash.display.MovieClip;
public var prev_mc:flash.display.MovieClip;
public var next_mc:flash.display.MovieClip;
public var current:int;
public var xmlData:XML;
public var timer:flash.utils.Timer;
public var timerGoing:Boolean;
Here is the folder uploaded on the server for you to get clear picture, please click on this link to download the entire folder. http://www.touchpixl.com/ForumsAdobecom.zip
I am not being able to resolve the issue, it needs a master to get the proper solution. I would request you to help me.
Thanks & Regards
Sanjib DasHere is the entire code of MainTimeline.as below, please correct it.
package FC_Home_Ads_Holder_v2_fla
import __AS3__.vec.*;
import adobe.utils.*;
import com.danehansen.*;
import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.plugins.*;
import flash.accessibility.*;
import flash.desktop.*;
import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.globalization.*;
import flash.media.*;
import flash.net.*;
import flash.net.drm.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.sensors.*;
import flash.system.*;
import flash.text.*;
import flash.text.engine.*;
import flash.text.ime.*;
import flash.ui.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class MainTimeline extends flash.display.MovieClip
public function MainTimeline()
new Vector.<String>(6)[0] = "Productivity";
new Vector.<String>(6)[1] = "Leadership";
new Vector.<String>(6)[2] = "Execution";
new Vector.<String>(6)[3] = "Education";
new Vector.<String>(6)[4] = "Speed of Trust";
new Vector.<String>(6)[5] = "Sales";
super();
addFrameScript(0, this.frame1);
return;
public function init():void
var loc1:*=null;
com.greensock.plugins.TweenPlugin.activate([com.greensock.plugins.AutoAlphaPlugin]);
loc1 = new flash.net.URLLoader(new flash.net.URLRequest(this.XML_LOC));
var loc2:*;
this.next_mc.buttonMode = loc2 = true;
this.prev_mc.buttonMode = loc2 = true;
stage.scaleMode = flash.display.StageScaleMode.NO_SCALE;
stage.align = flash.display.StageAlign.TOP_LEFT;
loc1.addEventListener(flash.events.Event.COMPLETE, this.xmlLoaded, false, 0, true);
this.prev_mc.addEventListener(flash.events.MouseEvent.CLICK, this.minusClick, false, 0, true);
this.next_mc.addEventListener(flash.events.MouseEvent.CLICK, this.plusClick, false, 0, true);
return;
public function xmlLoaded(arg1:flash.events.Event):void
var loc1:*=null;
var loc2:*=0;
this.xmlData = new XML(arg1.target.data);
loc2 = 0;
while (loc2 < this.LABELS.length)
loc1 = new Btn(this.LABELS[loc2], loc2);
this.btnHolder_mc.addChild(loc1);
this.BTNS.push(loc1);
trace(this.LABELS[loc2]);
++loc2;
this.current = uint(this.xmlData.@firstPick);
trace("-----width-----");
trace(this.contentMask.width);
var loc3:*=this.contentMask.width / this.LABELS.length;
trace(loc3);
loc2 = 0;
while (loc2 < this.BTNS.length)
this.BTNS[loc2].width = loc3;
this.BTNS[loc2].x = loc3 * loc2;
++loc2;
this.btnHolder_mc.addEventListener(flash.events.MouseEvent.CLICK, this.numClick, false, 0, true);
this.selectMovie();
return;
public function numClick(arg1:flash.events.MouseEvent):void
this.killTimer();
this.current = arg1.target.i;
this.selectMovie();
return;
public function killTimer():void
this.timerGoing = false;
if (this.timer)
this.timer.reset();
this.timer.addEventListener(flash.events.TimerEvent.TIMER, this.plusClick, false, 0, true);
this.timer = null;
return;
public function selectMovie():void
if (this.timerGoing)
this.timer = new flash.utils.Timer(uint(this.xmlData.ad[com.danehansen.MyMath.modulo(this.current, this.xmlData.ad.length())].@delay), 1);
this.timer.start();
this.timer.addEventListener(flash.events.TimerEvent.TIMER, this.plusClick, false, 0, true);
while (this.holder_mc.numChildren > 0)
this.holder_mc.removeChild(this.holder_mc.getChildAt(0));
var loc1:*=new flash.display.Loader();
loc1.load(new flash.net.URLRequest(this.xmlData.ad[com.danehansen.MyMath.modulo(this.current, this.xmlData.ad.length())].@loc));
this.holder_mc.addChild(loc1);
var loc2:*=0;
while (loc2 < this.BTNS.length)
this.BTNS[loc2].deselect();
++loc2;
this.BTNS[com.danehansen.MyMath.modulo(this.current, this.xmlData.ad.length())].select();
var loc3:*=this.BTNS[com.danehansen.MyMath.modulo(this.current, this.xmlData.ad.length())].x + this.BTNS[com.danehansen.MyMath.modulo(this.current, this.xmlData.ad.length())].width / 2 + this.btnHolder_mc.x;
trace("addLength:" + this.xmlData.ad.length());
trace(loc3, com.danehansen.MyMath.modulo(this.current, this.xmlData.ad.length()));
com.greensock.TweenLite.to(this.indicator_mc, 0.3, {"x":loc3, "ease":com.greensock.easing.Cubic.easeOut});
loc1.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, this.adLoaded, false, 0, true);
return;
public function adLoaded(arg1:flash.events.Event):void
var evt:flash.events.Event;
var loc1:*;
evt = arg1;
try
evt.target.content.xmlData = this.xmlData.ad[com.danehansen.MyMath.modulo(this.current, this.xmlData.ad.length())];
catch (er:Error)
return;
public function minusClick(arg1:flash.events.MouseEvent):void
this.killTimer();
var loc1:*;
var loc2:*=((loc1 = this).current - 1);
loc1.current = loc2;
this.selectMovie();
return;
public function plusClick(arg1:flash.events.Event):void
if (arg1.type != "timer")
this.killTimer();
var loc1:*;
var loc2:*=((loc1 = this).current + 1);
loc1.current = loc2;
this.selectMovie();
trace("next");
return;
public function ENDED(arg1:flash.events.Event):void
if (arg1.type != "timer")
this.killTimer();
var loc1:*;
var loc2:*=((loc1 = this).current + 1);
loc1.current = loc2;
this.selectMovie();
trace("next");
return;
public function STARTED(arg1:flash.events.Event):void
this.killTimer();
return;
function frame1():*
this.timerGoing = true;
addEventListener("endNow", this.ENDED, false, 0, true);
addEventListener("startNow", this.STARTED, false, 0, true);
this.init();
return;
public const XML_LOC:String=stage.loaderInfo.parameters.xmlLoc ? stage.loaderInfo.parameters.xmlLoc : "home_ads.xml";
public const LABELS:__AS3__.vec.Vector.<String>=new Vector.<String>(6);
public const BTNS:__AS3__.vec.Vector.<Btn>=new Vector.<Btn>();
public const TRANSITION_TIME:Number=0.2;
public var contentMask:flash.display.MovieClip;
public var btnHolder_mc:flash.display.MovieClip;
public var holder_mc:flash.display.MovieClip;
public var indicator_mc:flash.display.MovieClip;
public var prev_mc:flash.display.MovieClip;
public var next_mc:flash.display.MovieClip;
public var current:int;
public var xmlData:XML;
public var timer:flash.utils.Timer;
public var timerGoing:Boolean; -
hello,
I am trying to load a menu as an external file .... and getting this : TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com::menu()
here is my code:
if(!menuLoader){
var menuRequest:URLRequest = new URLRequest("menu.swf");
var menuLoader:Loader = new Loader();
menuLoader.load(menuRequest);
container.addChild(menuLoader);
menuLoader.x = 700;
menuLoader.y = 50;
can anyone give me a helping hand?
thanks in advance.use:
here is my code:
if(menuLoader!=null){
var menuRequest:URLRequest = new URLRequest("menu.swf");
var menuLoader:Loader = new Loader();
menuLoader.load(menuRequest);
container.addChild(menuLoader);
menuLoader.x = 700;
menuLoader.y = 50;
Maybe you are looking for
-
My daughter has inadvertantly tried to charge her iPod nano 6 into an imported laptop. It has completely frozen all action. I have tried to hold - button or main button for suggested 8 seconds to RESET the iPod to no avail. SUGGESTIONS ?? :+)
-
Hi, My mum has an ipad and wants to print off it. She has just brought a Cannon Pixma MG3150 wireless all in one printer. We have gone through the manual and tried to set up the link between the ipad and the printer. She has a Zyxel AMG1202 wireless
-
The billion 7800n is an awsome Router for all,it`s a little technical but once understood this will help your connection to BT broadband, see some info in setting up SNR http://www.spaldwick.com/broadband/billion-7800n
-
Love my iPad. Hate the absence of Flash.
Love my iPad - hate the absence of Flash. Many websites require Flash. So, I have to revert to MS (brrrrrr) for simple enquiries.
-
Hi, I am had made a BDC for the tcode QP01 few months back and i am facing a problem that it is not able to execute after 18 line items as i had commited a mistake by not presseing the Page down during recording. It is workng fine for the 18 lines it