简体   繁体   中英

Issue loading external swf on main file with as3

Hi I'm new to Flash CS6 and and AS3 and I have been stuck on this iPad/Android restaurant menu I have been doing. I amm trying to load an external swf on my main swf but have been getting this error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at cuisine/init()[C:\Users\PAO\Desktop\OZ\SWIPE\cuisine.as:32]
    at cuisine()[C:\Users\PAO\Desktop\OZ\SWIPE\cuisine.as:22]

I got the code of the swipes from a tutorial I found online. in the different sections fo the menu I was planning to load different swfs because I couldn't get the code to work for all the sections at the same time.

like I said, I am new to as3 and I really don't understand all the coding so i'm really stuck at a dead end.

hoping a kind soul could help me get out of this rut. the files can be found here

It can be a bit unintuitive to load external SWFs, especially if you are new to AS3. If I remember correctly, a big problem can be that you need to wait for the ENTIRE swf to load before trying to access anything.

You should only try to access code from the external swf after the Event.COMPLETE event. see here for more info

I would also suggest use the Greensock loader instead since it's a bit simpler.

Hope that helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM