Add some custom class loading to the mag...
first add some node-type to the xml called class
<class src='name.swf' name=dir.classname' param='param1,param2,paramX' />
change the page.as objects:
INTERNAL_ELEMENTS:Array = new Array("area", "img", "nav", "snd", "txt", "class");
INTERNAL_CLASSES:Array = new Array(Area, Image, Navigation, Audio, Text, ExternalClass);
add some lines to the megazine parser
var classID:String = (pageData[id] as XML).children()[0].toXMLString();
if (StringUtils.contains(classID, "<class"))
{
var param:Array = Delimiter.parseComma((pageData[id] as XML).children()[0]
.@param.toXMLString());
dataProvider[param[0]] = param;
}
The Delimiter class separates the param-attribute into an array.
The dataProvider is a simple array, as a private property from the megazine class
define another AbstractElement called ExternalClass
load the src from the class-node
if (
xml.@name.toString() != "") { classname =
xml.@name.toString(); }
classLoader.load(url, false);
and init the class after loading.
classLoader.removeEventListener(ClassLoader.CLASS_LOADED, onEvent);
classItem = classLoader.getClass(classname);
var id:int = page.getNumber(even) + 1;
var obj:* = new classItem();
obj.init(mz.dataProvider[id], false);
obj.setCallback(mz.callback);
Note that every external class loading container implements an interface called IPage
function init(data:Array, logstatus:Boolean):void;
function getData():Array;
function setCallback(callback:Function):void;
that's it...
the forum is not the best for publishing code...
if you interested, i send you the customized code snippets...