Adobe Flash CS4 not loading external SWF files into UILoader

smithee

New Member
Messages
45
Reaction score
2
Points
0
Hi everyone,

I'm following a tutorial book I've borrowed from a friend of mine on ActionScript 3.0. It's for Adobe Flash CS5, but I'm adapting, and creating my own files instead of using the ones mentioned in the tutorials.

Anyways, I'm up to the stage where it describes the process of loading external files dynamically by using a UILoader component. I have followed it to a tee, however when I came round to test it, it doesn't seem to load it properly. In the book, it describes that it "will seamlessly load into the interface with its full functionality"... but it doesn't! To test if it may be the scripting itself, I've added a random image into the list to see if it will load that, of which it does. Therefore I don't think it's anything to do with the scripts themselves, which is why I'm posting this here and not in Programming Help.

Can anyone shed any light onto this? Files can be downloaded below for personal analysis (in a ZIP folder). The files in concern are "uiloader.fla" and "uiloader.swf":

http://csmith.x10hosting.com/tutorialsAS3_uptoUILoader.zip

Here's a preview of the .fla file:
uiloader_flashscreenshot.PNG

Many thanks! :)
 

sankalpgarud98

New Member
Messages
108
Reaction score
0
Points
0
Hey, why dont you try to load that file not by using action script but by using flash itself. I dont remember the name now, but its something like uiloader properties or somewhere along those lines. If that files successfully loads, then you may have problem with the script, I know uve tested with another file.I probably think that you are trying to load a file which isnt supported by the UI loader.
cheers mate, you just refreshed my memories with flash coz Ive left it this year to devote more time in academics.
Thx
 

smithee

New Member
Messages
45
Reaction score
2
Points
0
Hey, why dont you try to load that file not by using action script but by using flash itself. I dont remember the name now, but its something like uiloader properties or somewhere along those lines. If that files successfully loads, then you may have problem with the script, I know uve tested with another file.I probably think that you are trying to load a file which isnt supported by the UI loader.
cheers mate, you just refreshed my memories with flash coz Ive left it this year to devote more time in academics.
Thx

Okay, that sounds like an idea to test what's what. I've created a new Flash file, and just put a UILoader straight in, and defined it without any AS. This was done by clicking it, going to the Component Inspector, and manually entering in the file to load. I tested this on the image, which works fine. I've then tested this on a newly created SWF file that simply has scribbles on, and that shows up fine. When loading both of the SWF files as before, neither was working. Therefore it must be the scripting in them.

To determine what it didn't like, I copied over assets across from instruments.swf bit by bit to the SWF that did work, starting with the button, and then parts of the code itself. The strange thing is that I copied everything across, and that file works! I then did the same for paint.swf, and the same results appeared! When I loaded them into the original uiloader.fla/swf, they actually worked!

Well... one at a time. When I ran it, it will load one up fine, and then when you proceed to view the next one, you get errors like this:

Code:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
	at noAS_test_fla::MainTimeline/startDrawing()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
	at noAS_test_fla::MainTimeline/stopDrawing()

If you went to re-launch the movie and click the second one first, that will load up fine... but the first one wouldn't! I'm guessing that's due to the EventListeners for the previous clip is still being called, as I'm still able to draw when I click "Instruments".

It's a shame you can't have destructor that get automatically called, like in C++. I could have used such a thing to automatically remove the listeners.

Thanks for suggesting your method! Looks like a bug to me, but I suppose I'll have to live with it...
 

sankalpgarud98

New Member
Messages
108
Reaction score
0
Points
0
type errors are very very common and generally are nonsense.... although some are genuine...
When you migrated all the codes and assets, there is a possibility that you havent changed its paths (location on your system) . Thats the probable reason i can think of. What you said, the automatic event destructors arent available in as3 , but I remember there was a stop code. Also you may wanna try stopping it with a function ie embedding a stop code inside of a function and then triggering it whenever needed. Sorry I couldnt be specific because i could not remember...
cheers and toasts
 
Top