Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...

Dcoo

Members
  • Posts

    62
  • Joined

  • Last visited

Posts posted by Dcoo

  1. Are you saying that you're manually changing the size/position/rotation of elements instead of going THROUGH TransformManager? If so, yes, that'd cause things to get out of calibration but you should be able to call the TransformManager's updateSelection() method to force it to redraw the selection properly. 

     

    I'd actually recommend going through TransformManager to make any of those changes. For example, instead of changing the target's x/y/width/height, change the TransformItem's properties itself. That'll ensure that things stay in sync. 

    I'm not sure how to change the TransformItem's properties since there dynamically created clones? and also not sure how to use the updateSelection method, but I'm defiantly not doing it right here: ( I've used the name of my Transfommanager )

    for (var i: int = 0; i < items.length; i++) {TweenLite.to(items[i].target, 0.75,{x:picCenter_x,, width:myw, height:mph});
    manager.updateSelection();
    
    
    }
  2. It seems I can use "manager.selectedTargetObjects" to change dropShadowFilter, color, opacity and so many other things.
    but I cant seem to get it to resize an item. when i click my button, the bitmap inside the holder resizes and snaps back when you click on the item again. but if i was to put a drop shadow on the same way it works on the holder..

    shot1b.png
     
    shot2b.png
     
     
     
     
     
    Any help would be most appreciated.
     
     
     
     
    fit_in.buttonMode = true;
     
    fit_in.addEventListener(MouseEvent.CLICK, fitwindow);
     
     
    function fitwindow(e: MouseEvent): void {
     
    var myh = stage.stageHeight - 57.7;
    var myw = stage.stageWidth; 
     
    var items: Array = manager.selectedTargetObjects;
     
        
     var stageCenter_x:Number = stage.stageWidth/2;
     var stageCenter_y:Number = stage.stageHeight/2;
     
            
     var picCenter_x:Number = items.width/2;
     var picCenter_y:Number = items.height/2;
     
            
          items.x = stageCenter_x - picCenter_x;
          items.y = stageCenter_y - picCenter_y;
     
     
     
    for (var i: int = 0; i < items.length; i++) {
    TweenLite.to(items.target, 0.75,{x:picCenter_x, y:picCenter_y, width:myw, height:myh});
    }
     
     
    }

  3. Thanks Diaco, 

    i did not get your code to work for me, and it could be that Im trying to get it to work in Wordpress.

     

    the only code I can get to work is in Wordpress is from an example on this page 

    <script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/latest/TweenMax.min.js"></script>
    <script>
    jQuery(document).ready(function(){
    TweenMax.set('#slide3', {opacity: 0.5});
    });
    </script>

    and to further complicate things, i need to add  to spin a div when the user rolls over a link, so I add an id to the div that will spin and to the link that will trigger it. but I did get this workaround to work, but without an array. ( and runs under Wordpress) 

     

    <script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/latest/TweenMax.min.js"></script><script>
    
    jQuery(document).ready(function() {
    
    document.getElementById("spinit1").addEventListener('mouseover', btnHandler, false);
    var rotation = 0;
    
    function btnHandler(e) {
      TweenMax.to("#spin1", 1, {
          scale: 1.2,
          ease: Power4.easeOut});
    }
    }); 
    
    jQuery(document).ready(function() {
    
    
    document.getElementById("spinit1").addEventListener('mouseout', btnHandler, false);
    var rotation = 0;
    
    function btnHandler(e) {
      TweenMax.to("#spin1", .25, {
          scale: 1,
          ease: Power4.easeOut});
    }
    }); 
    
    jQuery(document).ready(function() {
    
    document.getElementById("spinit2").addEventListener('mouseover', btnHandler, false);
    var rotation = 0;
    
    function btnHandler(e) {
      TweenMax.to("#spin2", 1, {
          scale: 1.2,
          ease: Power4.easeOut});
    }
    }); 
    
    
    jQuery(document).ready(function() {
    
    
    document.getElementById("spinit2").addEventListener('mouseout', btnHandler, false);
    var rotation = 0;
    Ω
    
    function btnHandler(e) {
      TweenMax.to("#spin2", .25, {
          scale: 1,
          ease: Power4.easeOut});
    }
    }); 
    
    
    jQuery(document).ready(function() {
    
    
    
    document.getElementById("spinit3").addEventListener('mouseover', btnHandler, false);
    var rotation = 0;
    
    
    function btnHandler(e) {
      TweenMax.to("#spin3", 1, {
          scale: 1.2,
          ease: Power4.easeOut});
    }
    }); 
    
    
    jQuery(document).ready(function() {
    
    
    document.getElementById("spinit3").addEventListener('mouseout', btnHandler, false);
    var rotation = 0;
    
    function btnHandler(e) {
      TweenMax.to("#spin3", .25, {
          scale: 1,
          ease: Power4.easeOut});
    }
    }); 
    
    
    jQuery(document).ready(function() {
    
    
    document.getElementById("spinit4").addEventListener('mouseover', btnHandler, false);
    var rotation = 0;
    
    
    function btnHandler(e) {
      TweenMax.to("#spin4", 1, {
          scale: 1.2,
          ease: Power4.easeOut});
    }
    }); 
    
    
    jQuery(document).ready(function() {
    
    
    
    
    document.getElementById("spinit4").addEventListener('mouseout', btnHandler, false);
    var rotation = 0;
    
    
    
    function btnHandler(e) {
      TweenMax.to("#spin4", .25, {
          scale: 1,
          ease: Power4.easeOut});
    }
    }); 
      </script>
  4. I'm used to using flash to create an array, but I cant get my head around this.
    so far I have this working ( I finaly have tweenmax working in wordpress, but thats conversation for another day ) any help would be greatly appreciated ! thanks 
     

    <script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/latest/TweenMax.min.js"></script><script>
    
    
    
    jQuery(document).ready(function() {
    
    
    var whorolls = ["#movmystuff1", "#movmystuff2", "#movmystuff3", "#movmystuff4"];
    
    
    document.getElementById("whorolls").addEventListener('mouseover', btnHandler, false);
    var rotation = 0;
    
    
    
    
    function btnHandler(e) {
      TweenMax.to("whorolls", 2, {
          scale: 1.2,
          ease: Power4.easeOut});
    }
    });
    
    
    
    </script>
  5. I want to know if an object on stage is has been added to a particular  manager, if so preform function listen_for_manager using action:String  this code below obviously does not work, but something like this is what I'm trying to do



    listen_for_manager('add', stage.manager);         

    function listen_for_manager(action:String, target:IEventDispatcher):void
    {
    if (action == 'add'){
      //do something}

  6. In my last post on this subject, everything was going swimmingly with the "myImage.load(true);" being introduced to the scenario, when the user gets to the "take a picture" part of the app it works perfectly, they can retake the picture over and over and it loads the new image right away using  " Object(root).faceW.myImage.load(true); " from my Camara MC. now my new problem is if they (the user)want to go back and retake the picture after clicking finished(the app at this point has moved the play head to the next frame), the retake button takes back to the frame with the Camara loader but the image is no longer updated after taking any new pictures, only f you quit and restart does the new image load.

     

    any ideas on whats happening ? :) 
     

    import com.greensock.*;import com.greensock.loading.*;
    import com.greensock.events.LoaderEvent;
    import com.greensock.loading.display.*;
    
    
    import flash.filesystem.*;
    LoaderMax.activate([ImageLoader]);
    
    
    var file:String = "IMG_happy.jpg";
    var mypic:File = File.applicationStorageDirectory.resolvePath("Photos/"+file);
    
    var myImage:ImageLoader = new ImageLoader(mypic.url,{container:this,x:0,y:0,width:414,height:309,onComplete:onImageLoad});
    
    myImage.load(true);
    
    function onImageLoad(event:LoaderEvent):void {
      TweenLite.from(event.target.content, 1, {alpha:0});
     }
  7. You can just add CLICK or MOUSE_DOWN or MOUSE_UP listeners to individual DisplayObjects. You don't need to do anything special just because you're using TransformManager. 

    yourObject.addEventListener(MouseEvent.CLICK, yourFunction);

    Or perhaps I misunderstood your question.

    let me try and explain it better, I have objects that are dynamically added to my managaer and something like 40 other possible items add by the user from the library, so I'm thinking if there was a way to add a listener for anything that comes on the stage thats has already been added to my manager,and  if the user clicks it bingo!

    kinda like "manager.deleteSelection(); "

  8. I would like to trigger an event when the user clicks no an item in my TransformManager list, but I cant figure out what to listen for?

     

    here are some things I've tried:

     

    listener('add', manager);    

     

    listener('add', manager.selectedItems);

     

    ======

    So this works but obviously it heres all the other objects on stage if the user clicks them :)

     

    listener('add', this.stage);
     

    ========

  9. when a new picture is taken, it overwites IMG_happy.jpg in the photos folder, but doesn't update until the app is restarted

    import com.greensock.*;import com.greensock.loading.*;
    import com.greensock.events.LoaderEvent;
    import com.greensock.loading.display.*;
    
    
    import flash.filesystem.*;
    LoaderMax.activate([ImageLoader]);
    
    
    var file:String = "IMG_happy.jpg";
    var mypic:File = File.applicationStorageDirectory.resolvePath("Photos/"+file);
    
    var myImage:ImageLoader = new ImageLoader(mypic.url,{container:this,x:0,y:0,width:414,height:309,onComplete:onImageLoad});
    
    myImage.load(true);
    
    function onImageLoad(event:LoaderEvent):void {
      TweenLite.from(event.target.content, 1, {alpha:0});
     }
  10. I cant seem to get flushContent to work :(  I have something missing from my code but not sure what. in my example below I'm not using xml, just loading one jpg 

     

    If you are using an XMLLoader to load it the first time, you can reload it like so

     

    myXMLLoader.load(true) 

     

    setting the flushContent parameter to true will remove the previously loaded xml and reload the file again.

    import com.greensock.*;
    import com.greensock.loading.*;
    import com.greensock.events.LoaderEvent;
    import com.greensock.loading.display.*;
    
    
    import flash.filesystem.*;
    LoaderMax.activate ([ImageLoader]);
    
    
    var file:String = "IMG_happy.jpg";
    var mypic:File = File.applicationStorageDirectory.resolvePath("Photos/"+file);
    
    var myImage:ImageLoader = new ImageLoader(mypic.url,{container:this,x:0,y:0,width:414,height:309});
    
    
    myImage.load(true);
    

    by the way, this code works in air on iOS to load a saved image from applicationStorageDirectory, if anyones interested :)

  11. One more crop qustion, 

     

    After adding images to the crop

    crop = new Crop(imageLoader,manager);

    I can no longer tween their alpha, if I set alpha to 1 it turns black

    TweenMax.to(manager.selectedTargetObjects,.75,{alpha:1});

    Is it possible to have both?

×