0

The compiler produces error code

"1120: Access of undefined property master_mc." (bolded)

Anyone know what went wrong?
I followed a tutorial but there wasn't any explanation on how master_mc really works.

Please help make this script run properly.

Here's the link to the tutorial I tried.

var xmlRequest:URLRequest = new URLRequest("imageData.xml");  
var xmlLoader:URLLoader = new URLLoader(xmlRequest);  
var imgData:XML;  
var imageLoader:Loader;  
var rawImage:String;  
var rawH:String;  
var rawW:String;  

var imgNum:Number = 0;  
var checkSec:Timer = new Timer(100);  
var numberOfChildren:Number;  

xmlLoader.addEventListener(Event.COMPLETE, xmlLoadedF);  
master_mc.addEventListener(MouseEvent.CLICK, nextImgF);//problem
master_mc.buttonMode = true;//problem  

function xmlLoadedF(event:Event):void{  
    checkSec.start();  
    checkSec.addEventListener(TimerEvent.TIMER, checkerF);  
    imgData = new XML(event.target.data);    
}

function packagedF():void{  
    checkSec.removeEventListener(TimerEvent.TIMER, checkerF);  
    rawImage = imgData.image[imgNum].imgURL;  
    numberOfChildren = imgData.*.length();  
    rawW = imgData.image[imgNum].imgW;  
    rawH = imgData.image[imgNum].imgH;  
    imageLoader = new Loader;  
    imageLoader.load(new URLRequest(rawImage));  
    master_mc.addChild(imageLoader);//problem  
    imageLoader.x = (stage.stageWidth - Number(rawW))/2;  
    imageLoader.y = (stage.stageHeight - Number(rawH))/2;  
}

function checkerF(event:TimerEvent):void{  
    if(imgNum == 0){  
        packagedF();  
    }  
    else if(imgNum < numberOfChildren){  
        imageLoader.unload();  
        packagedF();  
    }  
    else{  
        imageLoader.unload();  
        imgNum = 0;  
        packagedF();  
    }  
}  

function nextImgF(event:MouseEvent):void{  
    checkSec.addEventListener(TimerEvent.TIMER, checkerF);  
    imgNum++;  
}
1
  • Select the code and hit ctrl-k to format it. I've done that for you - please go back and remove those > from the beginning of lines. Read the editing-help for full details Commented Jul 13, 2010 at 10:36

1 Answer 1

2

On the stage in Flash do you have a movieclip with the name master_mc? If not I would try making one and compiling again.

Sign up to request clarification or add additional context in comments.

1 Comment

@J1m1 Based on the code I assume the master_mc is an area for which the images will load onto and when clicked will fetch the next image? So draw a box big enough for your images, convert it to a MovieClip symbol (select it and press F8) and give it an instance name of master_mc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.