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 <[email protected]>
> 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.
> _______________________________________________
> [email protected]
> 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
>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
> _______________________________________________
> [email protected]
> 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
>
_______________________________________________
[email protected]
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

Reply via email to