Skip to main content
This topic has been closed for replies.

1 reply

Ned Murphy
Legend
April 7, 2013

For AS3, use the navigateToURL()

     navigateToURL(new URLRequest(http://www.wherever.com));

Known Participant
April 7, 2013

My website is viewable online at www.thewreath.org.  I still can't get the text to hyperlink to another site.  What should I do? The link I think gets broken and I can't see the dynamic content.  All I can see is red.

package

{

          import flash.display.MovieClip;

          import flash.events.Event;

          import flash.net.URLRequest;

          import flash.net.navigateToURL;

          import gs.TweenLite;

          import gs.easing.*;

          import org.papervision3d.events.InteractiveScene3DEvent;

          import org.papervision3d.materials.MovieAssetMaterial;

          import org.papervision3d.objects.DisplayObject3D;

          import org.papervision3d.objects.primitives.Plane;

          import org.papervision3d.view.BasicView;

          public class DocClass extends BasicView

          {

                    public var plane:Plane;

                    public var plane1:Plane;

                    public var plane2:Plane;

                    public var current:Plane;

                    public var home:MovieAssetMaterial;

                    public var about:MovieAssetMaterial;

                    public var contact:MovieAssetMaterial;

                    public var centerY:Number;

                    public var centerX:Number;

                    public function DocClass()

                    {

                              super(0, 0, true, true);

                              centerY = stage.stageHeight / 2;

                              centerX = stage.stageWidth / 2;

                              home = new MovieAssetMaterial("homeMat", true, true);

                              about = new MovieAssetMaterial("aboutMat", true, true);

                              contact = new MovieAssetMaterial("contactMat", true, true);

                              home.interactive = true;

                              home.smooth = true;

                              about.interactive = true;

                              about.smooth = true;

                              contact.interactive = true;

                              contact.smooth = true;

                              plane = new Plane(home, 350, 90, 1, 1);

                              plane.name = "homeButton";

                              plane.useOwnContainer = true;

                              plane.alpha = 0;

                              plane1 = new Plane(about, 350, 90, 1, 1);

                              plane1.name = "aboutButton";

                              plane1.useOwnContainer = true;

                              plane1.alpha = 0;

                              plane2 = new Plane(contact, 350, 90, 1, 1);

                              plane2.name = "contactButton";

                              plane2.useOwnContainer = true;

                              plane2.alpha = 0;

                              plane.z = plane1.z = plane2.z =-600;

                              plane.x = -400;

                              plane1.x = 0;

                              plane2.x = 400;

                              plane.addEventListener(InteractiveScene3DEvent.OBJECT_PRESS, clicked);

                              plane1.addEventListener(InteractiveScene3DEvent.OBJECT_PRESS, clicked);

                              plane2.addEventListener(InteractiveScene3DEvent.OBJECT_PRESS, clicked);

                              plane.addEventListener(InteractiveScene3DEvent.OBJECT_OVER, over);

                              plane1.addEventListener(InteractiveScene3DEvent.OBJECT_OVER, over);

                              plane2.addEventListener(InteractiveScene3DEvent.OBJECT_OVER, over);

                              plane.addEventListener(InteractiveScene3DEvent.OBJECT_OUT, out);

                              plane1.addEventListener(InteractiveScene3DEvent.OBJECT_OUT, out);

                              plane2.addEventListener(InteractiveScene3DEvent.OBJECT_OUT, out);

                              scene.addChild(plane);

                              scene.addChild(plane1);

                              scene.addChild(plane2);

                              startRendering();

                              TweenLite.to(plane, .5, {alpha:1});

                              TweenLite.to(plane1, .5, {alpha:1, delay:.5});

                              TweenLite.to(plane2, .5, {alpha:1, delay:1});

                    }

                    protected override function onRenderTick (e:Event = null):void

                    {

                              var rotY: Number = (mouseY - centerY) / centerY * 200;

                              var rotX: Number = (mouseX - centerX) / centerX * 200;

                              camera.x += (rotX - camera.x) / 10;

                              camera.y -= (rotY + camera.y) / 10;

                              super.onRenderTick();

                    }

                    public function clicked(e:InteractiveScene3DEvent):void

                    {

                              trace(e.target.name);

                              switch(e.target.name)

                              {

                                        case "homeButton":

                                                  navigateToURL(new URLRequest("http://index.html"), "_blank");

                                                  break;

                                        case "aboutButton":

                                                  navigateToURL(new URLRequest("http://google.com"), "_blank");

                                                  break;

                                        case "contactButton":

                                                  navigateToURL(new URLRequest("http://www.google.co.uk"), "_blank");

                                                  break;

                              }

                    }

                    public function over(e:InteractiveScene3DEvent):void

                    {

                              current = e.target as Plane;

                              viewport.buttonMode = true;

                              var obj:MovieClip = MovieClip(MovieAssetMaterial(current.material).movie);

                              TweenLite.to(obj, .4, {frame:20, ease:Back.easeIn});

                    }

                    public function out(e:InteractiveScene3DEvent):void

                    {

                              current = e.target as Plane;

                              viewport.buttonMode = false;

                              var obj:MovieClip = MovieClip(MovieAssetMaterial(current.material).movie);

                              TweenLite.to(obj, .4, {frame:1, ease:Back.easeOut});

                    }

          }

}

Message was edited by: chineseadam

Ned Murphy
Legend
April 7, 2013

I missed the "text" detail part of your first posting.  What in the code that you just showed is the problemed part?

If you want to link text that is in a textfield then you can use an html link if you assign the text to the htmlText property of the textfield.