Jump to content
Search Community

Eris419

Members
  • Posts

    17
  • Joined

  • Last visited

Posts posted by Eris419

  1. I found out that the parent container (newsImageBox) is what's messing it up. I was using a Box container instead of a Canvas container. The Box container automatically aligns its children.

     

    One thing I have a question about though, where do you add the ease type so it follows the proper format for transformAroundCenter tweens?

     

    Another minor annoyance is that the animation isn't very smooth. IE, it appears to be tween the object to the center and scaling it but the combination of both animations appears "step like" or "jittery" instead of smooth. Any ideas on how to optimize it?

  2. I can't seem to get transformAroundCenter to work on a Flex Image container.

     

    Here's the Greensock code:

    TweenMax.to(newsImage, .25, 
    				new TweenMaxVars().transformAroundCenter({
    					scale:newScale
    				})
    			);

     

    Here's the Flex code:

    
    

     

    Here's the plugin activation code:

    TweenPlugin.activate([DropShadowFilterPlugin, TransformAroundCenterPlugin]);

     

    I'm building an app to let a user view a larger image inside a mask clipped box. It's just like those product image viewers on e-commerce sites. The Image container is user-draggable/repositionable. I'm trying to build zoom in/out buttons so the user can zoom in on the image. However, when TransformAroundCenter tweens the image, it moves the image from whatever position it was on the screen to 0,0 and then applies a scale tween to it. What I want it to do is scale from the center of the image.

     

    I've been wracking my brain on this for the past 3-4hrs. Anyone have any suggestions?

  3. Holy crap! I finally figured it out! Here's the answer in BOLD, so no one else has to waste DAYS trying to figure out why you are getting that error:

     

    Do not activate plugins in a creationComplete="init()" function inside Flex, it won't work activate properly!

     

    You think it would call that init() function and execute all the code in there properly, but it doesn't. Why? I don't know. Even when I stripped down my init() function to just include the activate plugin code all by itself, it still didn't work! BUT...when I moved the activation code into another function and called it, everything worked fine! It must be a Flex life cycle thing.

     

    Now, I can sleep. :D

  4. Thanks.

     

    If you are really green or higher, yes you should have TransformAroundPointPlugin.as in the plugins directory.

     

    Please verify.

     

    Ok, I just verified and it's in the package we downloaded. However, we are using the SWC, which should be the same, I'm assuming.

     

    Make sure you are importing and activating.

     

    make sure your project is pointing to the proper greensock package too.

     

    I think my imports look alright:

     

    import com.greensock.TweenLite;
    		import com.greensock.easing.Back;
    		import com.greensock.plugins.TransformAroundCenterPlugin;
    		import com.greensock.plugins.TweenPlugin;
    

     

    Sometimes people have old .swc files laying around that cause conflicts too.

     

    I just doubled checked and we're referencing only the one SWC in the Flex project build path.

     

    I've actually wanted to use this class earlier in the project because it's so cool and we don't have to mess with nested containers (in order to transform around center) but it's a bit difficult to get it working. Any other suggestions?

     

    Thanks! :)

     

    BTW, here's the exact error message:

     

    Error #1069: Property TransformAroundCenter not found on flash.display.Sprite and there is no default value.

     

    And here's how I implement the tween:

     

    private function intro():void {
    			 TweenLite.to(currentImage, 2, 
    				{
    					alpha:1,
    					TransformAroundCenter:
    					{
    						scaleX:1, 
    						scaleY:1, 
    						rotation:0
    					},
    					ease:Back.easeOut
    				}
    			); 
    		}

  5. Hey Carl, I didn't even realize that you were the guy behind snorkl.tv, I love that site! Very polished tutorials! :D

     

    So, our company paid for a license and got the Greensock package. Is it safe to assume that the TransformAroundCenterPlugin is included in our package or is there something extra we have to do to unlock it or get it?

     

    I'm getting the same error outlined by OP and I think I'm activating it correctly:

     

    private function init():void {
    			pages 		 = new Array();
    			currentImage = new Sprite();
    			TweenPlugin.activate([TransformAroundCenterPlugin]);
    		}

     

    init() is called from here:

     

    		   width="100%" height="100%" clipContent="false" 
    	   horizontalScrollPolicy="off" verticalScrollPolicy="off"
    	   styleName="transparentModal"
    	   creationComplete="init()"
    	   >

  6. We just recently purchased the licensed version of Greensock and I'm having trouble loading images that are being returned by an aspx web service. The URL is:

     

    http://pdf.newspaperarchive.com/API/asc ... =167076425

     

    And the error I'm getting is:

     

    Error: LoaderMax could not parse http://pdf.newspaperarchive.com/API/ascRenderLarge.aspx?pdfid=167076425. Don't forget to use LoaderMax.activate() to activate the necessary types of loaders.
    

     

    The code I'm using to activate the appropriate loader is:

     

    LoaderMax.activate([imageLoader]);

     

    And this is the code I'm using to load the URLs array:

     

    queue = LoaderMax.parse(pageURLs,
    									{maxConnections:4,
    									 onProgress:progressHandler,
    									 onComplete:completeHandler, 
    									 onError:errorHandler},
    									{height:docHeight,
    									 scaleMode:"proportionalInside",
    									 x:0,
    									 y:0});

     

    Everything seems to work fine if I use an array of URLs linking directly to images, but if I link it to a web service that returns an image, it fails.

     

    Is LoaderMax not compatible with web services or is there something I'm missing?

     

    Thanks!

  7. Thanks for the quick reply Carl.

     

    Yes, the developer who worked on this before me put the free TweenMax lib in another FB project, but it's in another project. However, it is still a part of the entire game.

     

    I'll explore that recommendation and let you know if it works.

     

    BTW, do I want to put that code in the nested object or the parent or both?

     

    Thanks again!

  8. It's been a long time since I've used Greensock and I love all the new features it has.

     

    However, I vaguely remember being able to nest tweens inside objects. For example:

     

    Create object1.as class and put two tweens in their to make the object pulse in size and rotate. There are two tween functions with each onComplete calling the other so that the animation cycles.

     

    Then, declare and add myObject:Object1 to your project and tween it again, maybe along a path.

     

    The end effect is supposed to be Object1, rotating and pulsing in size as it moves along a path.

     

    But, I noticed that adding multiple Tween statements targeting the same object seems to kill all previous tweens, is this so?

     

    Also, my company just purchased the Club Greensock licensed version and I've been trying to get this to work w/o any success?

     

    import com.greensock.plugins.TransformAroundPointPlugin;
    import com.greensock.plugins.TweenPlugin;

     

    FB4.5 gives me these error messages:

    1172: Definition com.greensock.plugins:TransformAroundCenterPlugin could not be found. WindEffect.as /Wind line 7 Flex Problem

    1172: Definition com.greensock.plugins:TransformAroundPointPlugin could not be found. WindEffect.as /Wind line 8 Flex Problem

     

    However, it is able to find this just fine:

    import com.greensock.plugins.ShortRotationPlugin;

     

    When I manually type out the import, FB4.5 is also able to code hint the entire class location of all 3 just fine! Crazy huh? However, it still throws those 2 error messages. Any ideas why?

     

    I'm importing Greensock as a SWC in the project properties panel.

  9. Oh, that's because there's no way for LinePath2D to know when you changed one of the Point's x/y coordinates so you need to call renderAll() on it to force it to update. The reason that wasn't necessary in the example was because the progress was being tweened, and every time progress is changed it automatically refreshes. So you can use an onUpdate in your tween(s) to call renderAll().

     

    Oh, okay, that makes sense. But, for us noobs, how do you call a protected function?

     

    In the .fla example, path is the LinePath2D object. When I try to call it using path.renderAll(), I get:

     

    1195: Attempted access of inaccessible method renderAll through a reference with static type com.greensock.motionPaths:LinePath2D.

  10. Thanks for the quick reply! :D

     

    If I understand you correctly, you should be able to simply tween the x/y of the LinePath2D instance. It's basically a Shape instance.

     

    I'm sorry, I meant tweening a line's points to move to different positions, similar to the effect in the .fla example, except without the addition of boxes onto the spline/path.

     

    I tried commenting out the code that I thought was not needed, ie, everything in this block:

     

    //create an array containing 30 blue squares
    var boxes:Array = [];
    for (i = 0; i < 30; i++) {
    boxes.push(createSquare(10, 0x0000FF));
    }
    
    //distribute the blue squares evenly across the entire path and set them to autoRotate
    path.distribute(boxes, 0, 1, true);
    
    //put a red square exactly halfway through the 2nd segment
    path.addFollower(createSquare(10, 0xFF0000), path.getSegmentProgress(2, 0.5));
    
    //tween all of the squares through the path once (wrapping when they reach the end)
    TweenMax.to(path, 20, {progress:1});
    
    //while the squares are animating through the path, tween the path's position and rotation too!
    //TweenMax.to(path, 3, {rotation:180, x:550, y:400, ease:Back.easeOut, delay:3});
    
    //method for creating squares
    function createSquare(size:Number, color:uint=0xFF0000):Shape {
    var s:Shape = new Shape();
    s.graphics.beginFill(color, 1);
    s.graphics.drawRect(-size * 0.5, -size * 0.5, size, size);
    s.graphics.endFill();
    this.addChild(s);
    return s;
    }

     

    However, if all the code above is removed, the point tweens fail to work. Any idea why this may be?

  11. Sure, I've attached an example. I also had to make one small tweak to the LinePath2D class, so make sure you use the attached one.

     

    Is this what you were looking for?

     

    Thanks for the great example! However, when I remove this line:

     

    TweenMax.to(path, 20, {progress:1});

     

    It fails to tween the line altogether. Any ideas why? I'm just looking for something to tween a line's position.

×
×
  • Create New...