Hello,
First post, but a reader for a few years now…
I have this:
External.fla + Main.as
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.display.Stage;
import flash.display.StageQuality;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
public class Main extends Sprite
{
var swfLoader:Loader;
var sprite_externa:Sprite;
public function Main()
{
stage.quality = StageQuality.BEST;
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
sprite_externa = new Sprite();
sprite_externa.graphics.beginFill(0x0000FF);
sprite_externa.graphics.drawRect( 0, 0, 500, 200); // (x, y, width, height)
sprite_externa.graphics.endFill();
addChild(sprite_externa);
swfLoader = new Loader();
swfLoader.load(new URLRequest("internal.swf"));
swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
stage.addEventListener(Event.RESIZE, stageResizer);
stage.dispatchEvent(new Event(Event.RESIZE));
}
private function onComplete(e:Event):void
{
addChild(swfLoader);
}
private function stageResizer(e:Event):void
{
sprite_externa.x = 10;
sprite_externa.width = stage.stageWidth - 20;
}
}
}
Internal.fla + Internal.as
package
{
import flash.display.Sprite;
import flash.display.Stage;
import flash.events.Event;
import flash.display.Stage;
import flash.display.StageQuality;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
public class Interno extends Sprite
{
var sprite_mc:Sprite;
public function Interno()
{
stage.quality = StageQuality.BEST;
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
sprite_mc = new Sprite();
sprite_mc.graphics.beginFill(0x000000);
sprite_mc.graphics.drawRect( 0, 0, 500, 200); // (x, y, width, height)
sprite_mc.graphics.endFill();
addChild(sprite_mc);
stage.addEventListener(Event.RESIZE, stageResizer);
stage.dispatchEvent(new Event(Event.RESIZE));
}
function stageResizer(e:Event):void
{
sprite_mc.x = 10;
sprite_mc.width = stage.stageWidth - 20;
sprite_mc.y = stage.stageHeight - sprite_mc.height;
}
}
}
I have on swf that has a stage resizer, and everything works great…
I have another swf that has a stage resizer, and everything works great…
I load on into the other, and errors apear…
TypeError: Error #1009: Cannot access a property or method of a null object reference. at Internal()
The objective is to have a swf that preloads another swf… the preloaderswf has a preloading bar that resizes to the size of the browser… and then, the loaded swf also resizes its content…
Is this possible?
Thanks in advanced