[Papervision3D] Problems width InteractiveScene3D and flex
John Grden
neoriley at gmail.com
Tue Aug 14 05:05:03 PDT 2007
I think the issue *might be with Flex2 and adding the event listener to the
stage is that its doing it too early in the instantiation process IE: stage
isn't set yet, and to make it work properly, it should wait for the
Event.ADDED_TO_STAGE from the container:
container.addEventListener(Event.ADDED_TO_STAGE, handleAddedToStage);
protected function handleAddedToStage(e:Event):void
{
container.stage.addEventListener(Event.RESIZE, handleResize);
container.stage.addEventListener(MouseEvent.MOUSE_UP,
handleReleaseOutside);
}
this would work for both Flex2 and AS3 swf's
it's important to get the resize events from the stage as the ISM needs to
reposition it's container with the scene - otherwise, your hit areas will
not match up with your 3D objects
Thanks for pointing this out guys, much appreciated!
On 8/14/07, James <pv3d at zavoo.com> wrote:
>
> Hey Pascual,
>
> I had to change two lines of code in
> "org/papervision3d/utils/InteractiveSceneManager.as" in order to get
> InteractiveScene3D working in flex. (I am currently using SVN Revision 146
> or 148)
>
> Change lines 44 & 45:
> container.stage.addEventListener(Event.RESIZE, handleResize);
> container.stage.addEventListener(MouseEvent.MOUSE_UP,
> handleReleaseOutside);
> to:
> container.addEventListener(Event.RESIZE, handleResize);
> container.addEventListener(MouseEvent.MOUSE_UP, handleReleaseOutside);
>
> I am also using two sprites as a container.
>
> var sprite:Sprite = new Sprite();
> var canvas:Sprite = new Sprite();
>
> this.rawChildren.addChild(sprite);
> sprite.addChild(canvas);
>
> var scene:InteractiveScene3D = new InteractiveScene3D(canvas);
>
> I believe the stage of the container is read only in flex so it throws an
> error when you try to add the event listeners.
> As far as I can tell the Interactive components still work properly<http://www.zavoo.com/flex/PhotoDoughnut/PhotoDoughnut.html>after making the changes.
>
> Regards,
> James
>
>
> Christoph Atteneder wrote:
>
> Hi,
>
> I am able to replace a Scene3D with an InteractiveScene3D, placing a
> InteractiveObject inside in Flex without any problems. What version of PV3D
> are you using?
>
> cheers,
>
> Christoph
>
> ------------------------------
> *From:* papervision3d-bounces at osflash.org [
> mailto:papervision3d-bounces at osflash.org<papervision3d-bounces at osflash.org>]
> *On Behalf Of *pascualparada at entornos3d.net
> *Sent:* Dienstag, 14. August 2007 10:50
> *To:* papervision3d at osflash.org
> *Subject:* [Papervision3D] Problems width InteractiveScene3D and flex
>
> Hello to all,
>
> I have an application in flex that works perfectly if scene3d = new
> Scene3D but it fails if I declare scene3d = new InteractiveScene3D (),
> because?
>
>
>
>
>
>
>
>
>
> *Pascual Parada Torralba*
> pascualparada at entornos3d.net
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ------------------------------
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.orghttp://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>
--
[ JPG ]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20070814/67c39696/attachment.html
More information about the Papervision3D
mailing list