Jump to content


  • Posts

  • Joined

  • Last visited

Posts posted by undefinedman

  1. Hey Jack, 


    I came back here because of one little (or not) thing to repair and I would like to have your opinion about that.


    On the video below I have showed how the scaling reacts on the button (MovieClip with elements inside).




    It goes wrong when I try to scale it from the handles you will see in the video.

    Element Button is a MovieClip which is containing background and textfield (not visible in the video, cause I have forgotten to enable it), Anyway I can't scale the Element Button like usually, because the background has to be redrawn to keep original radius corners or gradients and the text cannot be scaled always on the center of the button. What I did is:


    In the Main class where all elements are managed is:

    transformItem = transformManager.addItem(element);
    transformItem.minScale = 0;
    transformItem.minWidth = 20;
    transformItem.minHeight = 20;					
    transformItem.addEventListener(TransformEvent.MOVE, onMoveElement, false, 0, true);
    transformItem.addEventListener(TransformEvent.FINISH_INTERACTIVE_MOVE, onMoveElementComplete, false, 0, true);
    transformItem.addEventListener(TransformEvent.SCALE, onScaleElement, false, 0, true)
    transformItem.addEventListener(TransformEvent.SELECT, onSelectElement, false, 0, true);
    transformItem.addEventListener(TransformEvent.DESELECT, onDeselectElement, false, 0, true);
    transformItem.addEventListener(TransformEvent.DELETE, onRemoveElement, false, 0, true);

    While scaling the element I call updateProperties() method in the Element itself, this way I have always 'fresh' data. So in this case width, height, x, y, so the background can be drawn correctly.


    This is how the ButtonElement class look like.

    	import fl.motion.Color;
    	import flash.display.GradientType;
    	import flash.display.Shape;
    	import flash.events.Event;
    	import flash.geom.ColorTransform;
    	import flash.geom.Matrix;
    	import flash.text.TextField;
    	import flash.text.TextFormat;
    	import nl.adlantic.adbase.adcreator.models.vo.AdCreatorButtonElementVO;
    	import nl.adlantic.utils.FontManager;
    	import nl.adlantic.utils.MathUtil;
    	 * @author Grzegorz Tomasiak
    	 * @copy 2013 © AdLantic. All rights reserved.
    	public class AdCreatorButtonElement extends AdCreatorElement
    		private var textfield:TextField;
    		private var textFormat:TextFormat;
    		private var background:Shape;
    		private var border:Shape;
    		private var colorTransform:ColorTransform;
    		private var properties:AdCreatorButtonElementVO;
    		private var tempProperties:AdCreatorButtonElementVO;		
    		public function AdCreatorButtonElement()
    		 * Override
    		override public function setProperties($properties:Object):void
    			properties = $properties as AdCreatorButtonElementVO;
    			if (properties)
    		override public function updateProperties($properties:Object):void
    			tempProperties = new AdCreatorButtonElementVO($properties);
    			for (var prop:Object in $properties)
    				properties[prop] = tempProperties[prop];
    		 * Methods
    		private function createBackground():void
    			background = new Shape();
    			colorTransform = new ColorTransform();
    		private function createBorder():void
    			border = new Shape();			
    		private function createTextField():void
    			textFormat = new TextFormat();
    			textfield = new TextField();
    			textfield.multiline = true;
    			textfield.wordWrap = true;
    			textfield.selectable = false;
    		private function addObjects():void
    		private function updateBackground():void
    			var matrix:Matrix = new Matrix();
    			matrix.createGradientBox(properties.width, properties.height, Math.PI / 2);
    			background.graphics.beginGradientFill(GradientType.LINEAR, [properties.background_color, Color.interpolateColor(properties.background_color, 0x000000, .5)], [1, 1], [0, 255], matrix);
    			background.graphics.drawRoundRect(0, 0, properties.width, properties.height, properties.radius);
    			this.scaleX = 1;
    			this.scaleY = 1;
    			textfield.scaleX = 1;
    			textfield.scaleY = 1;
    			trace(this.x, this.y);
    		private function updateBorder():void
    			var matrix:Matrix = new Matrix();
    			matrix.createGradientBox(properties.width, properties.height, Math.PI / 2);
    			if(properties.border_thickness > 0)
    				border.graphics.lineStyle(properties.border_thickness, 0, 1, true);
    				border.graphics.lineGradientStyle(GradientType.LINEAR, [properties.border_color, Color.interpolateColor(properties.border_color, 0x000000, .5)], [1, 1], [0, 255], matrix);
    				border.graphics.drawRoundRect(properties.border_thickness / 2, properties.border_thickness / 2, properties.width - properties.border_thickness, properties.height - properties.border_thickness, properties.radius);
    		private function updateTextField():void
    			textFormat.color = properties.format.color;
    			textFormat.font = properties.format.font;
    			textFormat.size = properties.format.size;
    			textFormat.align = properties.format.align;
    			textFormat.bold = properties.format.bold;
    			textfield.text = properties.text;
    			textfield.width = properties.width;
    			textfield.height = 20;
    			if (FontManager.instance.isFontEmbedded(properties.format.font))
    			textfield.embedFonts = true;
    			else textfield.embedFonts = false;
    			textfield.y = background.height / 2 - textfield.height / 2;

    My question is, do you already know what's the problem and how to possibly fix it or you have advices to to that thing differently. Any help would be awesome. Thank you.

  2. Hey Jack,


    I've got some elements (MovieClips) that contains textfields inside. But simple question is:


    Is there any way to make the textfield area bigger while scaling via transform manager? Now it scales text also, so it's getting bigger or smaller, so it does not look good when for example an element is a button which contain label. I would like to keep font size always the same, but yeah, do you think is possible, or is there any better solution?


  3. someContentDisplayObject.loader.playVideo();


    are you sure? Because loader returns LoaderItem which does not contain playVideo(). It contains pause(), resume() but this simply does not work with the video that I have loaded.


    But I checked the sources that you gave me and instead of LoaderMax.getContent("myVideo") //returns ContentDisplay


    i Have used LoaderMax.getLoader("myVideo") and that's return VideoLoader :)


    Thanks for the help! The best library ever!

  4. Hello there,


    I have an issue with gathering VideoLoader from ContentDisplay (if this way is correct)


    Simply, I load some video via VideoLoader appended to LoaderMax and after onComplete event I get ContentDisplay target. In the other class I retrieve the ContentDisplay and even works and play on stage beautifully, but the thing is I don't know how to control this.. I mean VideoPlayer contains methods, like playVideo etc... How can I get it in other class via ContentDisplay, because I got Video via rawContent, but actually I don't know if shall I use it.. and how to use it...


    Is there a way to get it?


    Thanks in advance!

  5. I don't know it is a good way but I did something like that:


    				 TweenMax.to(sunrise_spooky.content, 1, {autoAlpha:1});
    				 TweenMax.to(layer_1_spooky.content, 1, {autoAlpha:1, delay:.1});
    				 TweenMax.to(layer_2_spooky.content, 1, {autoAlpha:1, delay:.2});
    				 TweenMax.to(layer_3_spooky.content, 1, {autoAlpha:1, delay:.3});
    				 TweenMax.to(layer_4_spooky.content, 1, {autoAlpha:1, delay:.4});


    and it works, better than last time..

  6. Hello,


    i got the problem.. I am alredy building the website, where I need to change the colors of the landscapes when I MOUSE_OVER on activators, but the problem is when I MOUSE_OVER the script stops for half second and then it works ok, but always the first time is not correct..



    there is demo online:





    when you go to blue activator you can see how problem looks..



    	private function spookyHouse_MOUSE_OVER(e:MouseEvent=null):void {
    		arrayInit(new Array(
    		function arrayInit(_Array:Array=null):void {
    			for(var a:String in _Array) {
    				TweenNano.to(_Array[a], 1, {alpha:1});


    I tried TweenNano, Lite, Max, and still the same problem.

  7. Hi there!


    I got a few questions about classes of tweens.


    1. What for is activate plugin?

    For example, I paste this: " TweenLite.to(mc, 1, {tint:0xff0000}); " and it's work. I don't have to write this " TweenPlugin.activate([TintPlugin]); ". So what for is that?


    2. When I check all plugins in PluginExplorer11 and I paste the code to Flash I got the error with all plugins marked as CLUB. Why?


    3. I paste this " TweenLite.to(mc, 0.5, {x:122, y:210, motionBlur:true, ease:Cubic.easeInOut}); " and I don't have motionBlur effect. The mc is moving correct but without that effect.

  8. greensock my master!


    I did it what you wrote, but:


    Do i have to do this on frame 60 in timeline? or can I write something like that in actions:


    onFrame(60) {

    TweenLite.to ....



    I was working in SwishMax couple years. Now I am trying to understand Flash CS4, AS3 and your tweens :)