Hi attila,
Surely thou eyes have tricked you!
Each button will need an extra instruction:
for instance:
button1.addEventListener (mouseEvent.CLICK, getPage);
function getPage(e:Event):void {
LoadPagePrloaded(“target.swf”, 0, 0); //this is a preload function I am about to explain
}
//the preload function covers all areas…except errorhandling.
function LoadPagePrloaded(targetSwf:String, xPos:Number, yPos:Number)
{
function startLoad()
{
var sLoader:Loader = new Loader();
var sRequest:URLRequest = new URLRequest(targetSwf); //this is where you reference the targetswf in the button eventlistener function
sLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);
sLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, busyLoading);
sLoader.load(mRequest);
}
function swfLoaded(loadedSwf:Event)
{
addChild(loadedSwf.currentTarget.content);
}
function busyLoading (swfProg:ProgressEvent)
{
var percent:Number = swfProg.bytesLoaded/swfProg.bytesTotal;
trace(percent);
//you could animate a preloader here
}
startLoad(); //this starts your instruction to load the file you requested under the button.
}
I did not explain the xPos and yPos but generally speaking if you where to load an external file into a movieclip then you could adjust the movieClip position by changing:
function swfLoaded(loadedSwf:Event)
{
addChild(loadedSwf.currentTarget.content);
}
to
function swfLoaded(loadedSwf:Event)
{
var mySwfHolder:MovieClip = new MovieClip;
addChild(mySwfHolder);
mySwfHolder.addChild(loadedSwf.currentTarget.content);
mySwfHolder.x = xPos;
mySwfHolder.y = yPos;
//pretty neat huh?
}
For the words you place on a pad are the codes we all shall read!
Happy coding!