This is G o o g l e's cache of http://www.flashsandy.org/forum/index.php?act=Print&client=printer&f=17&t=339 as retrieved on 1 Aug 2007 10:04:44 GMT.
G o o g l e's cache is the snapshot that we took of the page as we crawled the web.
The page may have changed since that time. Click here for the current page without highlighting.
This cached page may reference images which are no longer available. Click here for the cached text only.
To link to or bookmark this page, use the following url: http://www.google.com/search?q=cache:zbSFVlpwgWYJ:www.flashsandy.org/forum/index.php%3Fact%3DPrint%26client%3Dprinter%26f%3D17%26t%3D339+act%3DPrint+%22index+php%22+-lofiversion+site:www.flashsandy.org&hl=en&ct=clnk&cd=24


Google is neither affiliated with the authors of this page nor responsible for its content.
These terms only appear in links pointing to this page: act print index php

Printable Version of Topic

Click here to view this topic in its original format

Sandy's Forum _ AS2 1.x versions _ Update visibility of an object immediately

Posted by: Jeffrey Blyseth Feb 22 2007, 08:20 PM

When I set object.isVisible(true); it takes a moment before the object appears. Do I need to do something else to force the object to appear immediately?
Thanks

Posted by: Petit Feb 23 2007, 12:29 AM

QUOTE(Jeffrey Blyseth @ Feb 22 2007, 09:20 PM) *

When I set object.isVisible(true);


Hmm, sounds a bit strange to me. Are you sure you use the isVisible() method?
That is used to check if an Object3D is visible.
It takes no arguments, but returns a Boolean indicative of the objects visibility.

You should use setVisible( true ), which takes a Boolean argument and changes the visibility.

On the other hand, if that is in fact what you do, it may be possible that you have to trick the rendering engine to update, by making a fake movement of the camera, like camera.rotateY(0);
For some changes we have to make such a fake movement to force an update.

Not very elegant, but in some cases a very effective work around.


Posted by: Jeffrey Blyseth Feb 23 2007, 01:41 AM

QUOTE(Petit @ Feb 22 2007, 04:29 PM) *

You should use setVisible( true ), which takes a Boolean argument and changes the visibility.

On the other hand, if that is in fact what you do, it may be possible that you have to trick the rendering engine to update, by making a fake movement of the camera, like camera.rotateY(0);
For some changes we have to make such a fake movement to force an update.

Not very elegant, but in some cases a very effective work around.

Yes, I mistyped that, I am using setVisible(boolean), I tried the camera trick you mentioned but it didn't work, I still get a gap (I'm turning off visibility of an mc at the same time attempting to turn on visibility of the object). I'm going to make sure I am not making a mistake in my own logic before I try to look into the possibility of the engine having a problem.
Thanks for the input smile.gif

Posted by: Jeffrey Blyseth Feb 23 2007, 02:24 AM

Hi Petit,
I found that I could get the "immediate" response I wanted in this way.

I have an mc that I've drawn as a bitmap and added as the skin to a plane. When the user interacts with my mc, I'm hiding the plane (object.setVisible(false)wink.gif. When the user clicks something in my mc, I hide the mc and then turn on the plane.setVisible(true) and then send it a RotationInterpolator. This is the gap I was referring to, my mc dissappears and then there's a second before the plane becomes visible and starts turning. I've solved that by setting both my mc visibility=false and object.setVisible(true) in the onProgressEvent of the Interpolator. In this way I get a seemless transition.

But wait smile.gif There's more:

If I set the easing on my RotationInterpolator to easingIn, the onEnd event fires before the rotation is actually complete and I get a left over artifact of the object on the screen that is about half way rotated. If I set easingOut, I don't get that artifact... Really confused on this one.

EDIT: Even if I set the easing to default (linear) I still get the artifact, It seems like the onEnd is firing a bit before the screen render is actually done... Any ideas?

Just to clarify this a bit more, it only gets stuck if I call setVisible(false) for an object in the Interpolation endEvent for that object. If I don't attempt to turn off visibility the object Interpolation completes without a problem.

Posted by: Petit Feb 23 2007, 11:25 AM

QUOTE(Jeffrey Blyseth @ Feb 23 2007, 03:24 AM) *

Hi Petit,
I found that I could get the "immediate" response I wanted in this way.

I have an mc that I've drawn as a bitmap and added as the skin to a plane. When the user interacts with my mc, I'm hiding the plane (object.setVisible(false)wink.gif. When the user clicks something in my mc, I hide the mc and then turn on the plane.setVisible(true) and then send it a RotationInterpolator.

For us to see the artifact you ares talking about, it would be good if you could attach an example SWF.
A bit of example code to try to hunt down the culprit, wouldn't hurt smile.gif

Your explanations are quite readable, but there might be confusion anyway:
You say "I have an mc ...added as the skin to a plane", so the mc is a TextureSkin?
Then "When the user interacts with my mc, I'm hiding the plane", so we don't see the plane now.
Then "When the user clicks something in my mc, I hide the mc and then turn on the plane"

How do I interact with an mc sitting as a skin on a hidden plane?

Is it that the same mc is presented twice - both on and off the plane?

Posted by: kiroukou Feb 23 2007, 01:06 PM

QUOTE
EDIT: Even if I set the easing to default (linear) I still get the artifact, It seems like the onEnd is firing a bit before the screen render is actually done... Any ideas?

Yes that's it. If the onEndEvent is followed by an objectSetVisible( false ); it is possible that the object is rendered before or not.

Is it what annoy you ?

Posted by: Jeffrey Blyseth Feb 23 2007, 04:15 PM

Yes, I'm not sure why it would leave an artifact on the screen though. Even if it doesn't finish the Interpolation, it seems like the setVisible call should over ride all else. However, I think if I killed the interpolator in the onEnd event this might take care of it. I'll try that and report back.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)