Copy link to clipboard
Copied
I have a SWF file, with it's own buttons and events etc. that I am trying to load into a scrollpane in a parent application, and have it be scale-able (i.e. zoom in and out). It doesn't need to animate zoom, click to new scale is ok for now.
I have tried this in the document class:
package { import flash.display.MovieClip; import flash.display.Shape; import flash.display.Sprite; import flash.display.DisplayObject; import flash.events.*; import flash.geom.Rectangle; import flash.net.*; import flash.utils.Timer; import fl.containers.ScrollPane; public class InspectorShell extends MovieClip { private var gameToLoad:URLRequest = new URLRequest("inspector11.swf"); public function InspectorShell():void { var sp:ScrollPane = new ScrollPane(); sp.width = 600; sp.height = 400; sp.move(0,0); sp.scrollDrag = true; sp.verticalScrollPolicy = "false"; sp.horizontalScrollPolicy = "false"; sp.cacheAsBitmap = true; addChild(sp); sp.load(gameToLoad); sp.content.scaleX = .5; sp.content.scaleY = .5; } } }
Everything seems to work except the scale statements at the end, they generate a compiler error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at InspectorShell()
Copy link to clipboard
Copied
It's likely the lines where you set content.scaleX and scaleY since there is no content until it is actually loaded... you should do those inside a COMPLETE listener.