Jump to content
Search Community

gas512

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by gas512

  1. I ran into a problem with the TransformMatrixProxy, it's the weirdest thing.

     

    I am loading an external image (foreign URL) using the MovieClipLoader, and then want to rotate that using the proxy script. See code below.

    Before calling the " newMC = new TransformMatrixProxy(target_mc); " the image loads fine and I can tween it using the free TweenMax class.

     

    However as soon as I call the TransformMatrixProxy and try to use TweenMax with it I get that nasty error and the tween is not executed:

    *** Security Sandbox Violation ***

    SecurityDomain 'http://www.helpexamples.com/flash/images/image1.jpg' tried to access incompatible context 'file:///C|/Gregory/federated%5Fmedia/flashapp/imagetest.swf'

     

    Here is my code, I am wondering if I am doing something wrong, maybe shouldn't put the tween into an onLoadInit event? That seems to be the only one giving my image width and height after its loaded.

     

    System.security.allowDomain("*");
    
    import gs.TweenMax;
    import gs.utils.TransformMatrixProxy;
    import mx.transitions.easing.*;
    
    this.createEmptyMovieClip("img_mc", 999);
    var my_mcl:MovieClipLoader = new MovieClipLoader();
    
    // Create listener object:
    var mclListener:Object = new Object();
    mclListener.onLoadError = function(target_mc:MovieClip, errorCode:String, status:Number) {
       trace("Error loading image: " + errorCode + " [" + status + "]");
    };
    mclListener.onLoadStart = function(target_mc:MovieClip):Void {
       trace("onLoadStart: " + target_mc);
    };
    mclListener.onLoadProgress = function(target_mc:MovieClip, numBytesLoaded:Number, numBytesTotal:Number):Void {
       var numPercentLoaded:Number = numBytesLoaded / numBytesTotal * 100;
       trace("onLoadProgress: " + target_mc + " is " + numPercentLoaded + "% loaded");
    };
    mclListener.onLoadComplete = function(target_mc:MovieClip, status:Number):Void {
       trace("onLoadComplete: " + target_mc);
    };
    mclListener.onLoadInit = function(target_mc:MovieClip):Void {
       trace(target_mc._width);
       newMC = new TransformMatrixProxy(target_mc);
       newMC.registrationX = target_mc._x + (target_mc._width/2);
       newMC.registrationY = target_mc._y + (target_mc._height/2);
       TweenMax.to(newMC, 5, {rotation:1080, ease:None.easeOut});
    };
    
    my_mcl.addListener(mclListener);
    my_mcl.loadClip("http://www.helpexamples.com/flash/images/image1.jpg", img_mc);

×
×
  • Create New...