header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
Zandria
Points:0
Posts:0

5/11/2011 2:29:14 PM

Title: Help with undefined property!


Hello!

I am having a real quandary!

For my PhD thesis, I'm making an interactive point-and-click game in Flash that's based on my artwork using AS3 in Flash CS3. I'm an illustrator and wasn't expecting to be doing any coding during my PhD, or ever, really, so please excuse me if this is a n00b mistake.

I was building the final of my seven environments, went to test it and found that none of the interaction was working (apart from the skip intro button I had included in the first frame). The way each menu is set up is that there are a number of objects (named instances of movie clips) scattered around each environment, that call up an external .swf when clicked. There are also event listeners attached to each of these movie clips, that display a speech bubble when moused over.

I have used this code in six other menus, the only difference is that the names of the instances, external swfs and labelled frames are all different. I first thought that there might be a conflict with the code in the first frame, so I greyed it out in order to make Flash only run the code that follows the intro animation. This time, I am getting the error message "access of undefined property loaderRunning" which has me totally confused, since all I did was copy and paste the code in from another (fully working) menu and change the relevant names. I've tried building the menu up from scratch again, and I get the same error. I have checked my instance names, made sure I've labelled all my frames and nothing is working. I just can't understand why it's worked before and not here--I've built the menu in the exact same way I did the others!

Any help would be greatly appreciated, since I need to submit my thesis in a week and I'm running out of time. Thank you.

Here is my code (it's used over and over with a different instance name,for each interactive object, so I'm only including everything it takes to get one instance to be interactive.):



stop();

 var swf:MovieClip;
 var loader1:Loader=new Loader(); //use this for swf files with no interactivity
 var loader2:Loader=new Loader(); //use this for swf files with interactivity

 loader1.addEventListener(MouseEvent.MOUSE_DOWN,del lSWF);
 function dellSWF(event:Event):void{
 removeChild(loader1);
 loaderRunning=false;
 gotoAndStop("mmhover");
 }

 //================================================== =================

 reel.addEventListener(MouseEvent.MOUSE_OVER,screen Bubble);
 function screenBubble(event:Event):void{
 //display screen-related speech bubble when user hovers over reel
 gotoAndStop("screenbubble");

 }


 reel.addEventListener(MouseEvent.MOUSE_OUT,screenB ubbleGo);
 function screenBubbleGo(event:Event):void{
 //remove screen-related speech bubble when user removes mouse from reel
 if (loaderRunning==false){
 gotoAndStop("mmhover");
 }
 }

 //---------------------------------------

 reel.addEventListener(MouseEvent.MOUSE_DOWN,displa yScreenSWF);
 function displayScreenSWF(event:Event):void{
 var movie1SWF:URLRequest =new URLRequest("screen.swf");
 loader1.load(movie1SWF);
 loader1.x=0;
 loader1.y=0;
 addChild(loader1);
 loaderRunning=true;
 }




1
Troy
Points: 820
Posts:0
5/12/2011 5:44:50 AM



you have not declared the variable "loaderRunning";
after "stop()" function declare it by writing this

var loaderRunning:Boolean;

It should be working now


2
Zandria
Points: 0
Posts:0
5/12/2011 6:44:35 AM



Thank you very much!

As it turns out, I had the variable declared in the first frame (that contained the skip intro button as well as the custom cursor code). But despite all of this, the interactive movie clips won't work. I've spent more time trying to get to the bottom of this today; and am debating building up the menu from scratch again, since something is preventing the code from working, and it's not anything with the code itself; it has to be something on the timeline.

3
Brad
Points: 750
Posts:0
5/12/2011 7:35:24 AM



I will recommend you to install the debug version of flash player so that it can show you all the errors with detail to resolve. Normal flash player does not show all the errors and details.

http://www.adobe.com/support/flashplayer/downloads.html

Make sure that whatever you are accessing in the code is available in the timeline. Means a object created in frame 10 cannot be accessed in frame 1 . And also an object created in 1st fame can be accessed only in later frames if its still present in that time.

4
Zandria
Points: 0
Posts:0
5/13/2011 4:34:23 AM



The problem turned out to be with the timeline, and the bmp I had imported to use as the background. I printscreened my background, then saved it as a jpeg in Photoshop, brought it into Flash and used that as the background instead. Now it works fine!

Thank you for your help; this has been so edifying for me!


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 2+7 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions