• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Scaling a SWF in a scrollpane?

Engaged ,
Dec 07, 2009 Dec 07, 2009

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()

TOPICS
ActionScript

Views

392

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 07, 2009 Dec 07, 2009

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines