Re[2]: [Flashcoders] Fuse is adding up instead of tweening the difference
Values obtained from XML attributes are always strings, but the compiler doesn't know about that, since XMLNode.attributes is a simple Object, hence no type hinting available (there is no such problem with XMLNode.nodeValue, since it is declared as String). MdMS I assign it to a variable of type number. MdMS I thought that this would be enought to typecast my XML MdMS retrieved untyped value to number No, the compiler doesn't cast anything. Type checking is a compile-time process, while casting values is a run-time one. There is only type hinting in AS2, which means that during the compilation the compiler doesn't allow using incompatible values if it knows both the type of value to be used and the type of the required value where it would be used. If one or another is unknown (no type hint) the compiler cannot perform type checking and silently passes over that. Hinting the type of a variable doesn't mean that it cannot hold values of another types - it is only some help for the compiler for trying to detect and avoid such situations. So when you assign the value of a variable, which holds a string, but has no type hint (as members of Object), to another variable, which is typed as Number, actually the latter variable will contain the same string value. Do not forget, that in fact AS2 compiler is a preprocessor only, which produces the same output as AS1. If something cannot be done in AS1, it cannot be done in AS2, too. Attila =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= From:Marcelo de Moraes Serpa [EMAIL PROTECTED] To: Rákos Attila [EMAIL PROTECTED] Date:Thursday, August 9, 2007, 3:18:32 AM Subject: [Flashcoders] Fuse is adding up instead of tweening the difference --===-- Hi Rákos, Typecasting to Number() did the trick (i.e: Number(initHeight)). I'm intrigued however. Let me explain: The value comes untyped from a XML file (loadedthrough pixlib's ConfigLoader). Once it is in the player (untypedObject), I assign it to a variable of type number. Then I pass it to amethod that then does the following: var initWidth:Number = initialWidth; var initHeight:Number = initialHeight; I thought that this would be enought to typecast my XML retrieved untyped value to number but it seems that, even though I'm typing the variables to be a Number (var:Number), FlashPlayers doesn't typecast the values to Number. It only does so if Iexplicity call the typecast function Number() passing the variable asan argument. Is this expected behaviour for ActionScript 2 ? Thanks again, Marcelo. On 8/8/07, Rákos Attila [EMAIL PROTECTED] wrote: Number values mean absolute positions and string values mean relative positions. This is a documented feature :) Attila =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= From:Marcelo de Moraes Serpa [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Date:Wednesday, August 8, 2007, 11:13:34 PM Subject: [Flashcoders] Fuse is adding up instead of tweening the difference --===-- Hey guys, I'm having a really weird issue here. If someone could help me, I would be really grateful. I'm using the Fuse Kit (and ZigoEngine) to do the tweens of my AS2 Ria. I've a MovieClip which gets stretched up and then after some seconds, needs to get to its original size. If I put the actual values of the width and height in the sequence (ex: width:100,height:100) or typecast the variable to Number (which makes no sense since it **is** already a Number) Fuse tweens the MovieClip from the actual width,height to 100,100. However, if I use a variable, Fuse seems to add to the current width,height, making the MovieClip even bigger instead of tweening it to its original size. These values are retrieved from a XML file using PixLib's ConfigLoader class. Here's the code: initWidth:Number = this._initialWidth; initHeight:Number = this._initialHeight; var f:Fuse = new Fuse( { target:this.view, start_width:this.view._width, start_height:this.view._height, width:initWidth, //If I put a number here, it works height:initHeight, //If I put a number here, it works x:this._initialGrid_x, y:this._initialGrid_y, ease: easeOutBack }); f.start(); (...) **However**, if I typecast the initWidth and initHeight like this: var f:Fuse = new Fuse( { target:this.view, start_width:this.view._width, start_height:this.view._height, width:Number(initWidth), //or put the actual value, such as 100 height:Number(initHeight), //or put the actual value, such as 100 x:this._initialGrid_x, y:this._initialGrid_y, ease: easeOutBack }); f.start(); (...) ...It works as expected (it tweens-down to 100, not adds-up to the current width,height). However, I have no idea why... could someone enlighten me on it ? Thanks in advance, Marcelo.
[Flashcoders] Fuse is adding up instead of tweening the difference
Hey guys, I'm having a really weird issue here. If someone could help me, I would be really grateful. I'm using the Fuse Kit (and ZigoEngine) to do the tweens of my AS2 Ria. I've a MovieClip which gets stretched up and then after some seconds, needs to get to its original size. If I put the actual values of the width and height in the sequence (ex: width:100,height:100) or typecast the variable to Number (which makes no sense since it **is** already a Number) Fuse tweens the MovieClip from the actual width,height to 100,100. However, if I use a variable, Fuse seems to add to the current width,height, making the MovieClip even bigger instead of tweening it to its original size. These values are retrieved from a XML file using PixLib's ConfigLoader class. Here's the code: initWidth:Number = this._initialWidth; initHeight:Number = this._initialHeight; var f:Fuse = new Fuse( { target:this.view, start_width:this.view._width, start_height:this.view._height, width:initWidth, //If I put a number here, it works height:initHeight, //If I put a number here, it works x:this._initialGrid_x, y:this._initialGrid_y, ease: easeOutBack }); f.start(); (...) **However**, if I typecast the initWidth and initHeight like this: var f:Fuse = new Fuse( { target:this.view, start_width:this.view._width, start_height:this.view._height, width:Number(initWidth), //or put the actual value, such as 100 height:Number(initHeight), //or put the actual value, such as 100 x:this._initialGrid_x, y:this._initialGrid_y, ease: easeOutBack }); f.start(); (...) ...It works as expected (it tweens-down to 100, not adds-up to the current width,height). However, I have no idea why... could someone enlighten me on it ? Thanks in advance, Marcelo. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Fuse is adding up instead of tweening the difference
Number values mean absolute positions and string values mean relative positions. This is a documented feature :) Attila =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= From:Marcelo de Moraes Serpa [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Date:Wednesday, August 8, 2007, 11:13:34 PM Subject: [Flashcoders] Fuse is adding up instead of tweening the difference --===-- Hey guys, I'm having a really weird issue here. If someone could help me, I would be really grateful. I'm using the Fuse Kit (and ZigoEngine) to do the tweens of my AS2 Ria. I've a MovieClip which gets stretched up and then after some seconds, needs to get to its original size. If I put the actual values of the width and height in the sequence (ex: width:100,height:100) or typecast the variable to Number (which makes no sense since it **is** already a Number) Fuse tweens the MovieClip from the actual width,height to 100,100. However, if I use a variable, Fuse seems to add to the current width,height, making the MovieClip even bigger instead of tweening it to its original size. These values are retrieved from a XML file using PixLib's ConfigLoader class. Here's the code: initWidth:Number = this._initialWidth; initHeight:Number = this._initialHeight; var f:Fuse = new Fuse( { target:this.view, start_width:this.view._width, start_height:this.view._height, width:initWidth, //If I put a number here, it works height:initHeight, //If I put a number here, it works x:this._initialGrid_x, y:this._initialGrid_y, ease: easeOutBack }); f.start(); (...) **However**, if I typecast the initWidth and initHeight like this: var f:Fuse = new Fuse( { target:this.view, start_width:this.view._width, start_height:this.view._height, width:Number(initWidth), //or put the actual value, such as 100 height:Number(initHeight), //or put the actual value, such as 100 x:this._initialGrid_x, y:this._initialGrid_y, ease: easeOutBack }); f.start(); (...) ...It works as expected (it tweens-down to 100, not adds-up to the current width,height). However, I have no idea why... could someone enlighten me on it ? Thanks in advance, Marcelo. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Fuse is adding up instead of tweening the difference
Hi Rákos, Typecasting to Number() did the trick (i.e: Number(initHeight)). I'm intrigued however. Let me explain: The value comes untyped from a XML file (loaded through pixlib's ConfigLoader). Once it is in the player (untyped Object), I assign it to a variable of type number. Then I pass it to a method that then does the following: var initWidth:Number = initialWidth; var initHeight:Number = initialHeight; I thought that this would be enought to typecast my XML retrieved untyped value to number but it seems that, even though I'm typing the variables to be a Number (var:Number), Flash Players doesn't typecast the values to Number. It only does so if I explicity call the typecast function Number() passing the variable as an argument. Is this expected behaviour for ActionScript 2 ? Thanks again, Marcelo. On 8/8/07, Rákos Attila [EMAIL PROTECTED] wrote: Number values mean absolute positions and string values mean relative positions. This is a documented feature :) Attila =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= From:Marcelo de Moraes Serpa [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Date:Wednesday, August 8, 2007, 11:13:34 PM Subject: [Flashcoders] Fuse is adding up instead of tweening the difference --===-- Hey guys, I'm having a really weird issue here. If someone could help me, I would be really grateful. I'm using the Fuse Kit (and ZigoEngine) to do the tweens of my AS2 Ria. I've a MovieClip which gets stretched up and then after some seconds, needs to get to its original size. If I put the actual values of the width and height in the sequence (ex: width:100,height:100) or typecast the variable to Number (which makes no sense since it **is** already a Number) Fuse tweens the MovieClip from the actual width,height to 100,100. However, if I use a variable, Fuse seems to add to the current width,height, making the MovieClip even bigger instead of tweening it to its original size. These values are retrieved from a XML file using PixLib's ConfigLoader class. Here's the code: initWidth:Number = this._initialWidth; initHeight:Number = this._initialHeight; var f:Fuse = new Fuse( { target:this.view, start_width:this.view._width, start_height:this.view._height, width:initWidth, //If I put a number here, it works height:initHeight, //If I put a number here, it works x:this._initialGrid_x, y:this._initialGrid_y, ease: easeOutBack }); f.start(); (...) **However**, if I typecast the initWidth and initHeight like this: var f:Fuse = new Fuse( { target:this.view, start_width:this.view._width, start_height:this.view._height, width:Number(initWidth), //or put the actual value, such as 100 height:Number(initHeight), //or put the actual value, such as 100 x:this._initialGrid_x, y:this._initialGrid_y, ease: easeOutBack }); f.start(); (...) ...It works as expected (it tweens-down to 100, not adds-up to the current width,height). However, I have no idea why... could someone enlighten me on it ? Thanks in advance, Marcelo. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com