If you are loosing reference to the stage you can just pass it as a
parameter to the new object you are instatiating. You can also set it as a
variable that all objects have access. Singleton could be a good idea.

On Thu, Aug 7, 2008 at 5:28 AM, Ali Drongo <[EMAIL PROTECTED]> wrote:

> Hi everyone, sorry to flood the list with requests, I will put a bit back
> soon ;)
>
> I have created SWF that loads another SWF into it. This loaded SWF contains
> a movie clip that behaves like a camera zooming round the stage. This works
> fine when I load the external SWF in.
>
> My problem is that now I need to have everything in one SWF but when I
> import the external SWF into the library the camera effect stops working. I
> think this is something to do with the reference to the stage though I have
> no idea how to get around this and the project is already overdue.
>
> If someone could help out with this soon I would be so grateful.
>
> Thanks,
> Ali
>
> Here's the code for the camera:
>
> function camControl():Void {
>        trace(_parent._currentframe);
>        parentColor.setTransform(camColor.getTransform());
>        var scaleX:Number = sX/this._width;
>        var scaleY:Number = sY/this._height;
>        _parent._x = cX-(this._x*scaleX);
>        _parent._y = cY-(this._y*scaleY);
>        _parent._xscale = 100*scaleX;
>        _parent._yscale = 100*scaleY;
> }
> function resetStage():Void {
>        var resetTrans:Object = {ra:100, rb:0, ga:100, gb:0, ba:100, bb:0,
> aa:100, ab:0};
>        parentColor.setTransform(resetTrans);
>        _parent._xscale = 100;
>        _parent._yscale = 100;
>        _parent._x = 0;
>        _parent._y = 0;
> }
> // make frame invisible
> this._visible = false;
> // Capture stage parameters
> var oldMode:String = Stage.scaleMode;
> Stage.scaleMode = "exactFit";
> var cX:Number = Stage.width/2;
> var cY:Number = Stage.height/2;
> var sX:Number = Stage.width;
> var sY:Number = Stage.height;
> Stage.scaleMode = oldMode;
> // create color instances for color
> // transforms (if any).
> var camColor:Color = new Color(this);
> var parentColor:Color = new Color(_parent);
> // Make the stage move so that the
> // v-cam is centered on the
> // viewport every frame
> this.onEnterFrame = camControl;
> // Make an explicit call to the camControl
> // function to make sure it also runs on the
> // first frame.
> camControl();
> // If the v-cam is ever removed (unloaded)
> // the stage, return the stage to the default
> // settings.
> this.onUnload = resetStage;
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
...helmut
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to