Hi there,
I'm trying to do a simple interface using loaderMax:
an index.fla that loads external swf's ; basically a menu and a container on witch I load the content.
I've used loaderMax to load the menu (on a sprite called menu) and "main.swf" on a sprite (called contenido)
The menu has buttons that should change the content of the parent.container, but I can't seem to get the type casting or instance calling correclty
here is the (some) code of the index class:
public class index extends MovieClip
{
public var cargando_mc:loaderBase;
public var miMenu:menu; // this is my menu class
public var contenido:Sprite;
public function index()
{
LoaderMax.defaultAuditSize = false;
this.contenido = new Sprite();
addChild(contenido);
this.miMenu = new menu();
addChild(miMenu);
var queue:LoaderMax = new LoaderMax( { name:"mainQueue", onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler , auditSize:false } );
queue.append( new SWFLoader("main.swf", { name:"main", container:this.contenido, x:0, autoPlay:false } ) );
queue.append( new SWFLoader("menu.swf", {name:"menu", container:this.miMenu, x:0, autoPlay:false}) );
queue.load();
}
and the class "menu"
public class menu extends Sprite
{
public var bot1_btn:SimpleButton;
public var bot2_btn:SimpleButton;
public function menu()
{
//bot2_btn = new SimpleButton();
if (bot1_btn == null) {
bot1_btn = new SimpleButton();
}
bot1_btn.addEventListener(MouseEvent.CLICK, onClick);
}
public function onClick(evt:Event) {
trace(MovieClip(this.parent).contenedor);
// this output an error:
/*
TypeError: Error #1034: Type Coercion failed: cannot convert com.greensock.loading.display::ContentDisplay@4bf1191 to flash.display.MovieClip.
*/
}
}
I've also tried setting the original container as a property on menu.as but didn't work either...
Any ideas how to acomplish this?
I'm migrating from AS2 , so I'm not sure if this is a basic AS3 question or a greensock one
Thanks in advance!