Skip navigation
Currently Being Moderated

AS3 - Redirect to url after swf intro finishes

Mar 6, 2013 6:48 AM

Tags: #error #flash #as3 #3.0 #swf #action_script_3 #actionscript #intro #flash_professional #cs6 #flash_cs6

I have a flash intro that i edited from a template, i have access to the fla and action script, i want the swf to auto redirect to my home page after the swf has finished rather than having to click the logo, i have tried using navigatetoURL with no luck.

 

EDIT : hope this makes sense as i have searched the forums and had no success with other solutions and i would greatly appreciate an answer ASAP

EDIT2: ALSO TRIED THE VIDEO EVENT AS SHOWN AT BOTTOM OF CODE - From another thread solution.

 

package

{

          import br.com.stimuli.loading.BulkLoader;

          import br.com.stimuli.loading.BulkProgressEvent;

 

          import com.greensock.TimelineMax;

          import com.greensock.TweenMax;

          import com.greensock.easing.Elastic;

          import com.greensock.easing.Linear;

          import com.greensock.easing.Quad;

          import com.greensock.easing.Sine;

          import com.radykal.do3d.AnimatedLetter3D;

          import com.radykal.do3d.Stripe3D;

 

          import flash.net.*;

          import flash.display.Bitmap;

          import flash.display.GradientType;

          import flash.display.SpreadMethod;

          import flash.display.Sprite;

          import flash.display.StageAlign;

          import flash.display.StageQuality;

          import flash.display.StageScaleMode;

          import flash.events.Event;

          import flash.geom.Matrix;

          import flash.media.Sound;

          import flash.net.URLRequest;

          import flash.net.navigateToURL;

 

          import org.papervision3d.cameras.CameraType;

          import org.papervision3d.core.clipping.FrustumClipping;

          import org.papervision3d.core.culling.ViewportObjectFilter;

          import org.papervision3d.core.culling.ViewportObjectFilterMode;

          import org.papervision3d.core.effects.view.ReflectionView;

          import org.papervision3d.events.InteractiveScene3DEvent;

          import org.papervision3d.materials.BitmapMaterial;

          import org.papervision3d.objects.DisplayObject3D;

          import org.papervision3d.objects.primitives.Plane;

          import org.papervision3d.view.layer.util.ViewportLayerSortMode;

 

          public class StripeIntro3D extends ReflectionView

          {

                    private var background:Sprite;

                    private var bulkLoader:BulkLoader;

                    private var preloader3D:AnimatedLetter3D;

                    private var xml:XML;

                    private var stripeColor:Number;

                    private var textColor:Number;

                    private var mySound:Sound;

                    private var logoBitmap:Bitmap;

                    private var logoCon:Plane;

                    private var orbitAdded:Boolean = false;

                    private var rot:Number= 0.3;

                    private var camPitch:Number = 90;

                    private var camYaw:Number = 270;

                    private var easeOut:Number = 0.1;

 

                    public function StripeIntro3D()

                    {

                              //setting the stage

                              stage.frameRate = 31;

                              stage.scaleMode = StageScaleMode.NO_SCALE;

                              stage.align = StageAlign.TOP_LEFT;

                              stage.quality = StageQuality.HIGH;

                              stage.addEventListener(Event.RESIZE, onResize);

 

                              //setting the 3d view

                              super(stage.stageWidth, stage.stageHeight, true, true, CameraType.FREE);

 

                              addBackground();

                              init3D();

                              loadAssets();

                    }

 

                    private function addBackground():void

                    {

                              //draw a gradient background

                              background = new Sprite();

 

                              var fType:String = GradientType.LINEAR;

                              var colors:Array = [0xFFFFFF, 0xFFFFFF];

                              var alphas:Array = [1, 1];

                              var ratios:Array = [150, 255];

                              var matrix:Matrix = new Matrix();

                              matrix.createGradientBox(stage.stageWidth, stage.stageHeight, Math.PI * 0.5, 0, 0 );

 

                              var sprMethod:String = SpreadMethod.PAD;

                              background.graphics.beginGradientFill( fType, colors, alphas, ratios, matrix, sprMethod );

                              background.graphics.drawRect(0, 0, width, height);

 

                              this.addChildAt(background, 0);

                    }

 

                    private function init3D():void

                    {

                              //3d settings

                              this.surfaceHeight = -220;

                              this.addDropOff(40, 255, 5);

                              this.viewport.autoCulling = true;

                              this.camera.z = -400;

                              this.camera.x =400;

                              this.camera.zoom = 25;

                              this.camera.focus = 10;

                              this.renderer.clipping = new FrustumClipping(FrustumClipping.NEAR);

                              this.viewport.containerSprite.sortMode = ViewportLayerSortMode.Z_SORT;

                              this.viewportReflection.viewportObjectFilter = new ViewportObjectFilter(ViewportObjectFilterMode.EXCLUSIVE);

 

                              //add a 3d preloader

                              preloader3D = new AnimatedLetter3D("1%");

                              preloader3D.rotationY = -45;

                              preloader3D.x = preloader3D.width * 2;

                              this.scene.addChild(preloader3D);

 

                              //add render

                              this.addEventListener(Event.ENTER_FRAME, render);

                    }

 

                    private function loadAssets():void

                    {

                              //loading all assets with bulkloader

                              bulkLoader = new BulkLoader("assets");

 

                              bulkLoader.add("xml/settings.xml", {id:"main"});

                              bulkLoader.add("images/logo.jpg", {id:"logo"});

                              bulkLoader.add("sound/mySound.wav", {id:"mySound"});

                              bulkLoader.addEventListener(BulkProgressEvent.PROGRESS, loadingAssets);

                              bulkLoader.addEventListener(BulkProgressEvent.COMPLETE, assetsLoaded);

                              bulkLoader.start();

                    }

 

                    private function loadingAssets(evt:BulkProgressEvent):void

                    {

                              //loading progress

                              var totalBytes:Number = evt.bytesTotal;

                              var loadedBytes:Number = evt.bytesLoaded;

                              var loaderProgress:Number = Math.ceil(loadedBytes / totalBytes * 100);

 

                              if(Number(loaderProgress) && loaderProgress != Infinity)

                              {

                                        preloader3D.write = String(loaderProgress) + "%";

                              }

                    }

 

                    private function assetsLoaded(evt:BulkProgressEvent):void

                    {

                              this.scene.removeChild(preloader3D);

                              //getting the values from the xml file, the logo and the sound

                              xml = bulkLoader.getXML("main");

                              stripeColor = hexDecode(xml.colors.@stripe);

                              textColor = hexDecode(xml.colors.@text);

                              mySound = bulkLoader.getSound("mySound");

                              logoBitmap = bulkLoader.getContent("logo");

 

                              do3D();

                    }

 

                    private function do3D():void

                    {

                              //material for the logo plane

                              var logoMaterial:BitmapMaterial = new BitmapMaterial(logoBitmap.bitmapData, true);

                              logoMaterial.doubleSided = true;

                              logoMaterial.smooth = true;

                              logoMaterial.interactive = true;

 

                              //section one

                              var stripe1:Stripe3D = new Stripe3D(600, stripeColor);

                              stripe1.x = -400;

                              this.scene.addChild(stripe1);

                              var stripe2:Stripe3D = new Stripe3D(800, stripeColor);

                              stripe2.x = stripe1.x + stripe1.width;

                              stripe2.rotationY = 90;

                              this.scene.addChild(stripe2);

                              var text1:AnimatedLetter3D = new AnimatedLetter3D(xml.sections.one.text(), textColor); //min. 4 chars, max. 20 chars

                              text1.x = stripe2.x + 50;

                              text1.z = 800;

                              text1.scale = 2;

                              this.scene.addChild(text1);

 

                              //section two

                              var stripe3:Stripe3D = new Stripe3D(1500, stripeColor);

                              stripe3.x = 1366;

                              stripe3.z = 800;

                              stripe3.rotationY = 90;

                              this.scene.addChild(stripe3);

                              var text2:AnimatedLetter3D = new AnimatedLetter3D(xml.sections.two.text(), textColor); //min.5 chars, max.20 chars

                              text2.x = stripe3.x;

                              text2.z = stripe3.width + stripe3.z + text2.width * 2 + 50;

                              text2.rotationY = 90;

                              text2.scale = 2;

                              this.scene.addChild(text2);

                              var stripe4:Stripe3D = new Stripe3D(2000, stripeColor);

                              stripe4.x = text2.x;

                              stripe4.z = text2.z + 50;

                              stripe4.rotationY = 90;

                              this.scene.addChild(stripe4);

 

                              //section three

                              var stripe5:Stripe3D = new Stripe3D(8000, stripeColor);

                              stripe5.x = 600;

                              stripe5.z = text2.z - text2.width - 50;

                              stripe5.rotationX = 90;

                              stripe5.y = -100;

                              this.scene.addChild(stripe5);

                              var text3:AnimatedLetter3D = new AnimatedLetter3D(xml.sections.three.text(), textColor); //min.5 chars, max.20 chars

                              text3.x = stripe5.x + stripe5.width;

                              text3.z = stripe5.z - 100;

                              text3.rotationY = 90;

                              text3.localRotationZ = 180;

                              text3.scale = 2;

                              this.scene.addChild(text3);

 

                              //logo

                              logoCon = new Plane(logoMaterial, logoBitmap.width, logoBitmap.height);

                              logoCon.x = 7000;

                              logoCon.y = 100;

                              logoCon.z = text2.z - text2.width + 1000;

                              this.scene.addChild(logoCon);

 

                              //click handler for the logo

                              logoCon.addEventListener(InteractiveScene3DEvent.OBJECT_CLICK, openLink);

                              logoCon.addEventListener(InteractiveScene3DEvent.OBJECT_OVER, overLogo);

                              logoCon.addEventListener(InteractiveScene3DEvent.OBJECT_OUT, outLogo);

 

 

                              //timeline for section one

                              var sectionOne:TimelineMax = new TimelineMax({delay:1});

                              sectionOne.append(TweenMax.from(stripe1, 1, {scaleX:0, ease:Linear.easeNone, onStart:playSound}));

                              sectionOne.append(TweenMax.from(stripe2, 1, {scaleX:0, ease:Linear.easeOut}));

                              sectionOne.appendMultiple(TweenMax.allFrom(text1.letters3D, 2, {scale:3, rotationY:180, ease:Elastic.easeOut}, 0.05));

 

                              //timeline for section two

                              var sectionTwo:TimelineMax = new TimelineMax({delay:6.5});

                              sectionTwo.append(TweenMax.from(stripe3, 0.5, {scaleX:0, ease:Linear.easeNone}));

                              sectionTwo.appendMultiple(TweenMax.allFrom(text2.letters3D.reverse(), 1, {scale:0, y:300, ease:Sine.easeOut}, 0.05, remove3dObject, [[stripe1, stripe2, text1]]));

                              sectionTwo.append(TweenMax.from(stripe4, 1.5, {scaleX:0, ease:Linear.easeOut, onComplete:removeReflection, onCompleteParams:[text2]}));

                              sectionTwo.appendMultiple(TweenMax.allTo(text2.letters3D.sort(randomS ort), 1, {y:-4000, rotationZ:Math.random() * 360, ease:Quad.easeIn}, 0.03));

 

                              //timeline for section three

                              var sectionThree:TimelineMax = new TimelineMax({delay:11});

                              sectionThree.append(TweenMax.from(stripe5, 0.5, {scaleX:0, ease:Linear.easeNone, onComplete:removeReflection, onCompleteParams:[text3]}));

                              sectionThree.appendMultiple(TweenMax.allFrom(text3.letters3D, 1, {scale:0, ease:Sine.easeOut}, 0.05));

                              sectionThree.appendMultiple(TweenMax.allTo(text3.letters3D.reverse(), 0.3, {scaleX:0, delay:1, ease:Sine.easeIn}, 0.05, remove3dObject, [[stripe3, stripe4, text2]]));

 

                              //Logo tween

                              TweenMax.from(logoCon, 1.5, {x:-10000, rotationY:2000, delay:13.8, ease:Quad.easeOut});

 

                              //timeline for camera

                              var cameraTimeLine:TimelineMax = new TimelineMax({delay:1});

                              cameraTimeLine.append(TweenMax.to(this.camera, 5, {x:600, z:-300, ease:Linear.easeNone}));

                              cameraTimeLine.append(TweenMax.to(this.camera, 0.5, {z:1000, rotationY:40, ease:Sine.easeIn}));

                              cameraTimeLine.append(TweenMax.to(this.camera, 4.5, {z:text2.z - text2.width - 50, rotationY:90, bezierThrough:[{zoom:30}, {zoom:20}], ease:Linear.easeNone}));

                              cameraTimeLine.append(TweenMax.to(this.camera, 1, {x:5000, y:200, localRotationZ:-90, zoom:40, ease:Sine.easeIn}));

                              cameraTimeLine.append(TweenMax.to(this.camera, 2.5, {x:7000, localRotationX:15, ease:Linear.easeNone}));

                              cameraTimeLine.append(TweenMax.to(this.camera, 0.3, {localRotationX:0, localRotationZ:0, ease:Sine.easeIn}));

                              cameraTimeLine.append(TweenMax.to(this.camera, 0.2, {y:100, rotationY:0, rotationZ:0, rotationX:0, ease:Sine.easeOut, onComplete:remove3dObject, onCompleteParams:[[stripe5, text3]]}));

                              cameraTimeLine.append(TweenMax.to(this.camera, 6, {zoom:80, ease:Linear.easeNone}));

 

                    }

 

                    //linkage to your website

                    private function openLink(evt:InteractiveScene3DEvent):void

                    {

                              navigateToURL(new URLRequest(xml.logo.@link), xml.logo.@target);

                    }

 

                    //active buttonMode

                    private function overLogo(evt:InteractiveScene3DEvent):void

                    {

                              this.viewport.buttonMode = true;

                    }

 

                    //disable buttonMode

                    private function outLogo(evt:InteractiveScene3DEvent):void

                    {

                              this.viewport.buttonMode = false;

                    }

 

                    //render the scene

                    private function render(evt:Event):void

                    {

                              this.singleRender();

                    }

 

                    //play sound when animation starts

                    private function playSound():void

                    {

                              mySound.play(0, int.MAX_VALUE);

                    }

 

                    //resize handler

                    private function onResize(evt:Event):void

                    {

                              background.width = stage.stageWidth;

                              background.height = stage.stageHeight;

                    }

 

                    //removes 3d objects from the scene

                    private function remove3dObject(array:Array):void

                    {

                              for(var i:uint = 0; i < array.length; ++i)

                              {

                                        this.scene.removeChild(array[i]);

                              }

                    }

 

                    //disable reflection for a 3d objects

                    private function removeReflection(object3d:DisplayObject3D):void

                    {

                              viewportReflection.viewportObjectFilter.addObject(object3d);

                    }

 

                    private function randomSort(objA:Object, objB:Object):int

                    {

                              return Math.round(Math.random() * 2) - 1;

                    }

 

                    //decode a hexadecimal number into a number

                    private function hexDecode(colorStr:String):Number

                    {

                              var col:Number = parseInt(colorStr.substr(1), 16);

                              return col;

                    }

          }

}

import fl.video.VideoEvent;

 

 

function timedFunction(e:VideoEvent):void

{

     var request:URLRequest = new URLRequest("http://www.aceitservices.co.nf/home.hmtl");

     navigateToURL(request, "_self");

}

 

 

myVideoPlayer.addEventListener(VideoEvent.COMPLETE,timedFunction);

 

 
Replies
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 6, 2013 7:23 AM   in reply to aceitservices

    are you showing code from a document class?

     

    what determines the end of the intro?  is there a video playing?  is there a timeline that plays?  something else?

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 6, 2013 7:45 AM   in reply to aceitservices

    does the end of one of those tweens indicate the end of your intro?

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 6, 2013 8:19 AM   in reply to aceitservices

    you don't understand.

     

    when you're looking at your intro you see some animation with stripes, letters and the logo, correct?

     

    if yes, what's the last animation you see that indicates the end of the intro and the moment you want the redirect to occur.

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 6, 2013 8:50 AM   in reply to aceitservices

    then change:

     

    TweenMax.from(logoCon, 1.5, {x:-10000, rotationY:2000, delay:13.8, ease:Quad.easeOut});

     

    to:

     

    TweenMax.from(logoCon, 1.5, {x:-10000, rotationY:2000, delay:13.8, ease:Quad.easeOut,onComplete:openLink});

     

     

    and change:

     

            //linkage to your website

            private function openLink(evt:InteractiveScene3DEvent):void {

                navigateToURL(new URLRequest(xml.logo.@link), xml.logo.@target);

            }

     

    to:

     

            //linkage to your website

            private function openLink(evt:InteractiveScene3DEvent=null):void {

                navigateToURL(new URLRequest(xml.logo.@link), xml.logo.@target);

            }

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 6, 2013 9:00 AM   in reply to aceitservices

    delete all the code you added.  this stuff:

     

    import fl.video.VideoEvent;

    function timedFunction(e:VideoEvent):void

    {

         var request:URLRequest = new URLRequest("http://www.aceitservices.co.nf/home.hmtl");

         navigateToURL(request, "_self");

    }

    myVideoPlayer.addEventListener(VideoEvent.COMPLETE,timedFunction);

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 6, 2013 9:15 AM   in reply to aceitservices

    you have code on your main timeline that's not allowed because your document class is extending the sprite class, not the movieclip class.

     

    either extend the movieclip class or remove all code from your fla's main timeline.

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 6, 2013 9:30 AM   in reply to aceitservices

    i see a typo:  home.hmtl

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 6, 2013 12:58 PM   in reply to aceitservices

    copy and paste the code you're using after correcting your typo.

     

    also, post the url where the demo can be viewed.

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 6, 2013 2:39 PM   in reply to aceitservices

    1.  you have the following problems:

     

    a.  TypeError: Error #1009: Cannot access a property or method of a null object reference.

        at StripeIntro3D/playSound()

        at Function/http://adobe.com/AS3/2006/builtin::apply()

        at com.greensock::TweenMax/renderTime()

        at com.greensock::TimelineMax/renderTime()

        at com.greensock.core::SimpleTimeline/renderTime()

        at com.greensock::TweenLite$/updateAll()

    b.  [BulkLoader] Failed to get content with url: 'mySound'as type: [class Sound]

     

    so, you should fix that sound problem.  there's probably a sound file that needs to be uploaded.

     

    2.  add the following 3 trace functions to your code, publish a new swf and upload the new swf to your server.  let me know when that's done:

     

     

     

     

    package

    {

              import br.com.stimuli.loading.BulkLoader;

              import br.com.stimuli.loading.BulkProgressEvent;

     

              import com.greensock.TimelineMax;

              import com.greensock.TweenMax;

              import com.greensock.easing.Elastic;

              import com.greensock.easing.Linear;

              import com.greensock.easing.Quad;

              import com.greensock.easing.Sine;

              import com.radykal.do3d.AnimatedLetter3D;

              import com.radykal.do3d.Stripe3D;

     

              import flash.display.Bitmap;

              import flash.display.GradientType;

              import flash.display.SpreadMethod;

              import flash.display.Sprite;

              import flash.display.StageAlign;

              import flash.display.StageQuality;

              import flash.display.StageScaleMode;

              import flash.events.Event;

              import flash.geom.Matrix;

              import flash.media.Sound;

              import flash.net.URLRequest;

              import flash.net.navigateToURL;

     

              import org.papervision3d.cameras.CameraType;

              import org.papervision3d.core.clipping.FrustumClipping;

              import org.papervision3d.core.culling.ViewportObjectFilter;

              import org.papervision3d.core.culling.ViewportObjectFilterMode;

              import org.papervision3d.core.effects.view.ReflectionView;

              import org.papervision3d.events.InteractiveScene3DEvent;

              import org.papervision3d.materials.BitmapMaterial;

              import org.papervision3d.objects.DisplayObject3D;

              import org.papervision3d.objects.primitives.Plane;

              import org.papervision3d.view.layer.util.ViewportLayerSortMode;

     

              public class StripeIntro3D extends ReflectionView

              {

                        private var background:Sprite;

                        private var bulkLoader:BulkLoader;

                        private var preloader3D:AnimatedLetter3D;

                        private var xml:XML;

                        private var stripeColor:Number;

                        private var textColor:Number;

                        private var mySound:Sound;

                        private var logoBitmap:Bitmap;

                        private var logoCon:Plane;

                        private var orbitAdded:Boolean = false;

                        private var rot:Number= 0.3;

                        private var camPitch:Number = 90;

                        private var camYaw:Number = 270;

                        private var easeOut:Number = 0.1;

     

                        public function StripeIntro3D()

                        {

                                  //setting the stage

                                  stage.frameRate = 31;

                                  stage.scaleMode = StageScaleMode.NO_SCALE;

                                  stage.align = StageAlign.TOP_LEFT;

                                  stage.quality = StageQuality.HIGH;

                                  stage.addEventListener(Event.RESIZE, onResize);

     

                                  //setting the 3d view

                                  super(stage.stageWidth, stage.stageHeight, true, true, CameraType.FREE);

     

                                  addBackground();

                                  init3D();

                                  loadAssets();

                        }

     

                        private function addBackground():void

                        {

                                  //draw a gradient background

                                  background = new Sprite();

     

                                  var fType:String = GradientType.LINEAR;

                                  var colors:Array = [0xFFFFFF, 0xFFFFFF];

                                  var alphas:Array = [1, 1];

                                  var ratios:Array = [150, 255];

                                  var matrix:Matrix = new Matrix();

                                  matrix.createGradientBox(stage.stageWidth, stage.stageHeight, Math.PI * 0.5, 0, 0 );

     

                                  var sprMethod:String = SpreadMethod.PAD;

                                  background.graphics.beginGradientFill( fType, colors, alphas, ratios, matrix, sprMethod );

                                  background.graphics.drawRect(0, 0, width, height);

     

                                  this.addChildAt(background, 0);

                        }

     

                        private function init3D():void

                        {

                                  //3d settings

                                  this.surfaceHeight = -220;

                                  this.addDropOff(40, 255, 5);

                                  this.viewport.autoCulling = true;

                                  this.camera.z = -400;

                                  this.camera.x =400;

                                  this.camera.zoom = 25;

                                  this.camera.focus = 10;

                                  this.renderer.clipping = new FrustumClipping(FrustumClipping.NEAR);

                                  this.viewport.containerSprite.sortMode = ViewportLayerSortMode.Z_SORT;

                                  this.viewportReflection.viewportObjectFilter = new ViewportObjectFilter(ViewportObjectFilterMode.EXCLUSIVE);

     

                                  //add a 3d preloader

                                  preloader3D = new AnimatedLetter3D("1%");

                                  preloader3D.rotationY = -45;

                                  preloader3D.x = preloader3D.width * 2;

                                  this.scene.addChild(preloader3D);

     

                                  //add render

                                  this.addEventListener(Event.ENTER_FRAME, render);

                        }

     

                        private function loadAssets():void

                        {

                                  //loading all assets with bulkloader

                                  bulkLoader = new BulkLoader("assets");

     

                                  bulkLoader.add("xml/settings.xml", {id:"main"});

                                  bulkLoader.add("images/logo.jpg", {id:"logo"});

                                  bulkLoader.add("sound/mySound.wav", {id:"mySound"});

                                  bulkLoader.addEventListener(BulkProgressEvent.PROGRESS , loadingAssets);

                                  bulkLoader.addEventListener(BulkProgressEvent.COMPLETE , assetsLoaded);

                                  bulkLoader.start();

                        }

     

                        private function loadingAssets(evt:BulkProgressEvent):void

                        {

                                  //loading progress

                                  var totalBytes:Number = evt.bytesTotal;

                                  var loadedBytes:Number = evt.bytesLoaded;

                                  var loaderProgress:Number = Math.ceil(loadedBytes / totalBytes * 100);

     

                                  if(Number(loaderProgress) && loaderProgress != Infinity)

                                  {

                                            preloader3D.write = String(loaderProgress) + "%";

                                  }

                        }

     

                        private function assetsLoaded(evt:BulkProgressEvent):void

                        {

                                  this.scene.removeChild(preloader3D);

                                  //getting the values from the xml file, the logo and the sound

                                  xml = bulkLoader.getXML("main");

                                  stripeColor = hexDecode(xml.colors.@stripe);

                                  textColor = hexDecode(xml.colors.@text);

                                  mySound = bulkLoader.getSound("mySound");

                                  logoBitmap = bulkLoader.getContent("logo");

     

                                  do3D();

                        }

     

                        private function do3D():void

                        {

                                  //material for the logo plane

                                  var logoMaterial:BitmapMaterial = new BitmapMaterial(logoBitmap.bitmapData, true);

                                  logoMaterial.doubleSided = true;

                                  logoMaterial.smooth = true;

                                  logoMaterial.interactive = true;

     

                                  //section one

                                  var stripe1:Stripe3D = new Stripe3D(600, stripeColor);

                                  stripe1.x = -400;

                                  this.scene.addChild(stripe1);

                                  var stripe2:Stripe3D = new Stripe3D(800, stripeColor);

                                  stripe2.x = stripe1.x + stripe1.width;

                                  stripe2.rotationY = 90;

                                  this.scene.addChild(stripe2);

                                  var text1:AnimatedLetter3D = new AnimatedLetter3D(xml.sections.one.text(), textColor); //min. 4 chars, max. 20 chars

                                  text1.x = stripe2.x + 50;

                                  text1.z = 800;

                                  text1.scale = 2;

                                  this.scene.addChild(text1);

     

                                  //section two

                                  var stripe3:Stripe3D = new Stripe3D(1500, stripeColor);

                                  stripe3.x = 1366;

                                  stripe3.z = 800;

                                  stripe3.rotationY = 90;

                                  this.scene.addChild(stripe3);

                                  var text2:AnimatedLetter3D = new AnimatedLetter3D(xml.sections.two.text(), textColor); //min.5 chars, max.20 chars

                                  text2.x = stripe3.x;

                                  text2.z = stripe3.width + stripe3.z + text2.width * 2 + 50;

                                  text2.rotationY = 90;

                                  text2.scale = 2;

                                  this.scene.addChild(text2);

                                  var stripe4:Stripe3D = new Stripe3D(2000, stripeColor);

                                  stripe4.x = text2.x;

                                  stripe4.z = text2.z + 50;

                                  stripe4.rotationY = 90;

                                  this.scene.addChild(stripe4);

     

                                  //section three

                                  var stripe5:Stripe3D = new Stripe3D(8000, stripeColor);

                                  stripe5.x = 600;

                                  stripe5.z = text2.z - text2.width - 50;

                                  stripe5.rotationX = 90;

                                  stripe5.y = -100;

                                  this.scene.addChild(stripe5);

                                  var text3:AnimatedLetter3D = new AnimatedLetter3D(xml.sections.three.text(), textColor); //min.5 chars, max.20 chars

                                  text3.x = stripe5.x + stripe5.width;

                                  text3.z = stripe5.z - 100;

                                  text3.rotationY = 90;

                                  text3.localRotationZ = 180;

                                  text3.scale = 2;

                                  this.scene.addChild(text3);

     

                                  //logo

                                  logoCon = new Plane(logoMaterial, logoBitmap.width, logoBitmap.height);

                                  logoCon.x = 7000;

                                  logoCon.y = 100;

                                  logoCon.z = text2.z - text2.width + 1000;

                                  this.scene.addChild(logoCon);

     

                                  //click handler for the logo

                                  logoCon.addEventListener(InteractiveScene3DEvent.OBJEC T_CLICK, openLink);

                                  logoCon.addEventListener(InteractiveScene3DEvent.OBJEC T_OVER, overLogo);

                                  logoCon.addEventListener(InteractiveScene3DEvent.OBJEC T_OUT, outLogo);

     

     

                                  //timeline for section one

                                  var sectionOne:TimelineMax = new TimelineMax({delay:1});

                                  sectionOne.append(TweenMax.from(stripe1, 1, {scaleX:0, ease:Linear.easeNone, onStart:playSound}));

                                  sectionOne.append(TweenMax.from(stripe2, 1, {scaleX:0, ease:Linear.easeOut}));

                                  sectionOne.appendMultiple(TweenMax.allFrom(text1.lette rs3D, 2, {scale:3, rotationY:180, ease:Elastic.easeOut}, 0.05));

     

                                  //timeline for section two

                                  var sectionTwo:TimelineMax = new TimelineMax({delay:6.5});

                                  sectionTwo.append(TweenMax.from(stripe3, 0.5, {scaleX:0, ease:Linear.easeNone}));

                                  sectionTwo.appendMultiple(TweenMax.allFrom(text2.lette rs3D.reverse(), 1, {scale:0, y:300, ease:Sine.easeOut}, 0.05, remove3dObject, [[stripe1, stripe2, text1]]));

                                  sectionTwo.append(TweenMax.from(stripe4, 1.5, {scaleX:0, ease:Linear.easeOut, onComplete:removeReflection, onCompleteParams:[text2]}));

                                  sectionTwo.appendMultiple(TweenMax.allTo(text2.letters 3D.sort(randomSort), 1, {y:-4000, rotationZ:Math.random() * 360, ease:Quad.easeIn}, 0.03));

     

                                  //timeline for section three

                                  var sectionThree:TimelineMax = new TimelineMax({delay:11});

                                  sectionThree.append(TweenMax.from(stripe5, 0.5, {scaleX:0, ease:Linear.easeNone, onComplete:removeReflection, onCompleteParams:[text3]}));

                                  sectionThree.appendMultiple(TweenMax.allFrom(text3.let ters3D, 1, {scale:0, ease:Sine.easeOut}, 0.05));

                                  sectionThree.appendMultiple(TweenMax.allTo(text3.lette rs3D.reverse(), 0.3, {scaleX:0, delay:1, ease:Sine.easeIn}, 0.05, remove3dObject, [[stripe3, stripe4, text2]]));

     

                                  //Logo tween

    trace(logoCon.name);

                                  TweenMax.from(logoCon, 1.5, {x:-10000, rotationY:2000, delay:13.8, ease:Quad.easeOut,onComplete:openLink});

     

                                  //timeline for camera

                                  var cameraTimeLine:TimelineMax = new TimelineMax({delay:1});

                                  cameraTimeLine.append(TweenMax.to(this.camera, 5, {x:600, z:-300, ease:Linear.easeNone}));

                                  cameraTimeLine.append(TweenMax.to(this.camera, 0.5, {z:1000, rotationY:40, ease:Sine.easeIn}));

                                  cameraTimeLine.append(TweenMax.to(this.camera, 4.5, {z:text2.z - text2.width - 50, rotationY:90, bezierThrough:[{zoom:30}, {zoom:20}], ease:Linear.easeNone}));

                                  cameraTimeLine.append(TweenMax.to(this.camera, 1, {x:5000, y:200, localRotationZ:-90, zoom:40, ease:Sine.easeIn}));

                                  cameraTimeLine.append(TweenMax.to(this.camera, 2.5, {x:7000, localRotationX:15, ease:Linear.easeNone}));

                                  cameraTimeLine.append(TweenMax.to(this.camera, 0.3, {localRotationX:0, localRotationZ:0, ease:Sine.easeIn}));

                                  cameraTimeLine.append(TweenMax.to(this.camera, 0.2, {y:100, rotationY:0, rotationZ:0, rotationX:0, ease:Sine.easeOut, onComplete:remove3dObject, onCompleteParams:[[stripe5, text3]]}));

                                  cameraTimeLine.append(TweenMax.to(this.camera, 6, {zoom:80, ease:Linear.easeNone}));

     

                        }

     

                        //linkage to your website

                        private function openLink(evt:InteractiveScene3DEvent=null):void {

    trace("openLink",evt);

    trace(xml.logo.@link,xml.logo.@target);

                navigateToURL(new URLRequest(xml.logo.@link), xml.logo.@target);

            }

     

                        //active buttonMode

                        private function overLogo(evt:InteractiveScene3DEvent):void

                        {

                                  this.viewport.buttonMode = true;

                        }

     

                        //disable buttonMode

                        private function outLogo(evt:InteractiveScene3DEvent):void

                        {

                                  this.viewport.buttonMode = false;

                        }

     

                        //render the scene

                        private function render(evt:Event):void

                        {

                                  this.singleRender();

                        }

     

                        //play sound when animation starts

                        private function playSound():void

                        {

                                  mySound.play(0, int.MAX_VALUE);

                        }

     

                        //resize handler

                        private function onResize(evt:Event):void

                        {

                                  background.width = stage.stageWidth;

                                  background.height = stage.stageHeight;

                        }

     

                        //removes 3d objects from the scene

                        private function remove3dObject(array:Array):void

                        {

                                  for(var i:uint = 0; i < array.length; ++i)

                                  {

                                            this.scene.removeChild(array[i]);

                                  }

                        }

     

                        //disable reflection for a 3d objects

                        private function removeReflection(object3d:DisplayObject3D):void

                        {

                                  viewportReflection.viewportObjectFilter.addObject(obje ct3d);

                        }

     

                        private function randomSort(objA:Object, objB:Object):int

                        {

                                  return Math.round(Math.random() * 2) - 1;

                        }

     

                        //decode a hexadecimal number into a number

                        private function hexDecode(colorStr:String):Number

                        {

                                  var col:Number = parseInt(colorStr.substr(1), 16);

                                  return col;

                        }

              }

    }

     

     

     

    http://www.aceitservices.co.nf

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 6, 2013 2:58 PM   in reply to aceitservices

    this forum malformats code and there's no way (i know of) to prevent the forum screw ups.

     

    so, go back to your previous code and add the 3 trace functions i showed.

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 6, 2013 3:23 PM   in reply to aceitservices

    done.  continue the conversation via this forum, not email.

     

    kg

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 6, 2013 3:40 PM   in reply to aceitservices

    line 253 should be:

     

    trace(xml.logo.@link, xml.logo.@target);

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 6, 2013 3:52 PM   in reply to aceitservices

    it doesn't look like you're using that class code.  to confirm, change this function:

     

                        public function StripeIntro3D()

                        {

                                  //setting the stage

                                  stage.frameRate = 31;

                                  stage.scaleMode = StageScaleMode.NO_SCALE;

                                  stage.align = StageAlign.TOP_LEFT;

                                  stage.quality = StageQuality.HIGH;

                                  stage.addEventListener(Event.RESIZE, onResize);

     

                                  //setting the 3d view

                                  super(stage.stageWidth, stage.stageHeight, true, true, CameraType.FREE);

     

                                  addBackground();

                                  init3D();

                                  loadAssets();

                        }

     

    to:

     

                        public function StripeIntro3D()

                        {

    trace("starting");

                                  //setting the stage

                                  stage.frameRate = 31;

                                  stage.scaleMode = StageScaleMode.NO_SCALE;

                                  stage.align = StageAlign.TOP_LEFT;

                                  stage.quality = StageQuality.HIGH;

                                  stage.addEventListener(Event.RESIZE, onResize);

     

                                  //setting the 3d view

                                  super(stage.stageWidth, stage.stageHeight, true, true, CameraType.FREE);

     

                                  addBackground();

                                  init3D();

                                  loadAssets();

                        }

     

     

    republish your swf and upload.

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 6, 2013 4:09 PM   in reply to aceitservices

    you're not using the code i've been suggesting.

     

    create a new directory. 

    move the StripeIntro3D.as file that i sent into that new directory. 

    add that trace("starting") to the StripeIntro3D.as file in the new directory.

    save your fla to that new directory.

    check your publish settings (file>publish settings>swf>advanced) and make sure you do NOT have "omit trace statements" ticked.

     

    publish a new swf and html to that directory.  confirm that it's new by it's publish date/time.

     

    upload the new swf and html to your server.

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 6, 2013 4:22 PM   in reply to aceitservices

    upload the newly published swf and let me known when that's done.

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 6, 2013 4:28 PM   in reply to aceitservices

    assuming you aren't omitting trace statements, the suggested code was not used to publish the swf at:  http://www.aceitservices.co.nf/

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 6, 2013 5:02 PM   in reply to aceitservices

    i only offer free help via the forums.

     

    i only download and correct files if hired.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points