Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by undefinedman

  1. Hah you're the man! This solution was more than perfect. It resolved all my problems. Now button and other elements works exactly how it should be. Many many thanks for this clever idea
  2. 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). http://youtu.be/IreHrg27uwM 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); transformItemsArray.push(transformItem); 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. package { 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() { createBackground(); createBorder(); createTextField(); addObjects(); } /** * * Override * */ override public function setProperties($properties:Object):void { super.setProperties($properties); properties = $properties as AdCreatorButtonElementVO; if (properties) { updateBackground(); updateBorder(); updateTextField(); } } override public function updateProperties($properties:Object):void { super.updateProperties($properties); tempProperties = new AdCreatorButtonElementVO($properties); for (var prop:Object in $properties) { if(properties.hasOwnProperty(prop)) properties[prop] = tempProperties[prop]; } updateBackground(); updateBorder(); //updateTextField(); } /** * * 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; textfield.setTextFormat(textFormat); } private function addObjects():void { addChild(background); addChild(border); //addChild(textfield); } private function updateBackground():void { var matrix:Matrix = new Matrix(); matrix.createGradientBox(properties.width, properties.height, Math.PI / 2); background.graphics.clear(); 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); background.graphics.endFill(); 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); border.graphics.clear(); 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); border.graphics.endFill(); } } 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.setTextFormat(textFormat); 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.
  3. 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?
  4. 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!
  5. 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!
  6. 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..
  7. So what you suggest, what should I do? How can I tween fade in without the alpha property? In flash player - directly in flash cs5 whole swf works perfect, without any problems, I tried i guess everything....
  8. I forgot to tell you that I am using LoaderMax to load the Images; var layer_1:ImageLoader = new (_XML.LANDSCAPE.SPOOKY.Layer_1, {}); etc... and then I'm adding these loaders to MovieClips. layer_1_spookyHolder.addChild(layer_1.content); etc...
  9. Hello again, really thank you guys for the answers, but unfortunately did not help to me.. I think the problem is caused by very larg files.. I have 5 png files converted to MovieClips.. If I tween one image or two images it's OK, but when I tween five of them - now it's a problem.. Any advices?
  10. 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: www.grzegorztomasiak.pl/www/demo when you go to blue activator you can see how problem looks.. code: private function spookyHouse_MOUSE_OVER(e:MouseEvent=null):void { arrayInit(new Array( layer_1_spookyHolder, layer_2_spookyHolder, layer_3_spookyHolder, layer_4_spookyHolder )); function arrayInit(_Array:Array=null):void { for(var a:String in _Array) { TweenNano.to(_Array[a], 1, {alpha:1}); } } //disableDefaultLandscape(); } I tried TweenNano, Lite, Max, and still the same problem.
  11. 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.
  12. delay: 60 - THIS IS WHAT I NEED!! big thank to you!
  13. 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
  14. Hi there! I want to make the tweaning of a rectangle in frame 60 ? "TweenLite.to(rectangle, 1, {autoAlpha:0});" What should I do? Cause I got problem with it.