-
Problems with external library
Hello all!
I am trying to use external libraries for a tile engine, so I have a bg.swf with a mc class name "tiles" in the library. I load this swf in another one and i can´t "attach" the mc tiles on it. I was told that it is possible to use external library in AS3, so this was my atempt, i really aprecciate any help.
This is the code of the swf i am trying to load the mc tiles:
PHP Code:
package
{
import flash.display.*;
import flash.events.*;
import flash.net.URLRequest;
public class Test extends MovieClip
{
function Test()
{
var loader:Loader = new Loader();
loader.load(new URLRequest("Library/bg.swf"));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
}
function loadComplete(event:Event){
var library = event.target.content;
stage.addChild(new library.tiles())
}
}
}
The error is "TypeError: Error #1007: Instantiation attempted on a non-constructor."
Obs:Sorry for the bad english.
Thanks in advance.
-
Actionscript 3, postproduction
At least it's wrong to call 'library.tiles()', the Flash compiler couldn't understand what you mean exactly. Usually your 'library' is a Sprite instance, how can you find a function .tiles() under that?
Have you tried to create new instance with 'tiles()' directly?
I didn't try this but I loaded external swf files like you. The classes automatically generated from library linkage in those external swfs will be seen in some way from the main stage (what I found there couldn't be used a same class name in main library and external swfs library). Unfortunately we don't have enough debug information for more details.
Last edited by georgecalgary; 12-25-2006 at 02:30 AM.
-
Actionscript 3, postproduction
I think you might could call a function inside your external swf to create a new instance of 'tiles' class and return the reference back to main stage, thus you can addChild it anywhere.
-
I think you might could call a function inside your external swf to create a new instance of 'tiles' class and return the reference back to main stage, thus you can addChild it anywhere.
Oh thanks, this worked.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|