Jump to content
Search Community

Liquid Stage oddness

JFP test
Moderator Tag

Recommended Posts

Hi there,

just started experimenting with liquid stage, when I cut n paste the example from the demo-page into my movie and export without having touched the code (aside from importing easing), it throws this error..

 

Scene 1, Layer 'Layer 3', Frame 1, Line 6 1118: Implicit coercion of a value with static type Object to a possibly unrelated type Number.

 

here's the code:

 

import com.greensock.*;

import com.greensock.easing.*;

import com.greensock.layout.*;

var ls:LiquidStage = new LiquidStage(this.stage, 550, 555, 550, 555);

ls.attach(mc, ls.CENTER, false, 2, {ease:Quart.easeInOut});

 

whereas line 6 is: ls.attach(mc, ls.CENTER, false, 2, {ease:Quart.easeInOut});

 

I'm wondering what I'm doing wrong?

 

cheers, Jan

 

this is the url of the demo page, in case it matters: http://www.greensock.com/as/LiquidStage/

Link to comment
Share on other sites

for now try:

 

ls.attach(mc, ls.CENTER, false, true, 2, {ease:Quart.easeInOut});

 

I'm not a LiquidStage expert, but according to the docs, there are 4 parameters that are needed before the tween duration.

http://www.greensock.com/as/docs/tween/ ... ml#attach()

 

Parameters

target:DisplayObject — The DisplayObject to attach

 

pin:PinPoint — The PinPoint to which the target should be attached (like TOP_RIGHT or CENTER or a custom PinPoint)

 

strict:Boolean (default = false) — In strict mode, the target will be forced to remain EXACTLY the same distance from the pin as it was when it was attached. If strict is false, LiquidStage will honor any manual changes you make to the target's position, making it more flexible. Note that LiquidStage only performs updates to the target's position when the stage resizes and/or when update() is called.

 

reconcile:Boolean (default = true) — If true, the target's position will immediately be moved as far as the PinPoint has moved from its original position, effectively acting as though the target was attached BEFORE the stage was scaled. If you attach an object after the stage has been scaled and you don't want it to reconcile with the PinPoint initially, set reconcile to false.

 

tweenDuration:Number (default = 0) — To make the target tween to its new position instead of immediately moving there, set the tween duration (in seconds) to a non-zero value. A TweenLite instance will be used for the tween.

 

tweenVars:Object (default = null) — To control other aspects of the tween (like ease, onComplete, delay, etc.), use an object just like the one you'd pass into a TweenLite instance as the 3rd parameter (like {ease:Elastic.easeOut, delay:0.2})

 

roundPosition:Boolean (default = false) — To force the target's x/y position to snap to whole pixel values, set roundPosition to true (it is false by default).

 

It's possible that the demo needs to be updated to reflect a change in the feature set. Thanks for posting about your issue.

Link to comment
Share on other sites

Thank you for your replies & insights, but it still doesnt work - which is weird. I get no error on export, but my movie still doesn't behave like the demo swf or the url.. meaning my mc snaps to the position allright when I resize - but it's instant, no tween to be seen.

 

import com.greensock.*;

import com.greensock.easing.*;

import com.greensock.layout.*;

 

var ls:LiquidStage = new LiquidStage(this.stage, 550, 555, 550, 555);

ls.attach(mc, ls.CENTER, false, true, 1, {ease:Elastic.easeOut});

 

 

por favor, ayuda me? :)

Link to comment
Share on other sites

Hi again, this is happening before I view it in html - just regularly exporting it with strg+enter.. tried those settings that you posted as well, but to no avail.. heres my fla.. maybe that can give some insight..?

Link to comment
Share on other sites

couldn't open your cs5.5 file. I only have 5

 

try using a pinpoint other than CENTER:

 

ls.attach(mc, ls.BOTTOM_RIGHT, true, true, 2, {ease:Quart.easeInOut});

 

 

place some other assets on your stage. export. when you resize the swf you will notice they move with no help from ls.

in fact when you resize the swf all the assets on the stage move to maintain their relationship to the center of the stage.

so in actuality, the asset that you were pinning to CENTER, is going to maintain its relationship to the center naturally.. so there is no where to tween to.

I'm pretty sure that is what you are experiencing.

Link to comment
Share on other sites

Aha! That worked.. although.. if I cant center the object the way it works in the demo swf, I cant use it to make a cool site Im thinking of, which is kind of a sad thing. I tried a few of the other pinpoints, they work... the only one that doesn't work is the center point, and sadly thats the only one I need.. Ive reattached the fla as a cs5 version.. Oh, Great Greensock Gods.. please help ;)

Link to comment
Share on other sites

The problem is simply that you've got the stage aligned center (the default in Flash), so as you resize your window, the center is always...um...in the center, so LiquidStage doesn't have to move it at all. That's why there's no easing. All you'd need to do is set the stage's align to top left (and I'd also recommend setting the scaleMode to noScale):

 

stage.align = "TL";
stage.scaleMode = "noScale";

 

Do that BEFORE you create your LiquidStage and you'll be all set. I've attached a revised copy of your file.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...