Skip navigation
Pomodu
Currently Being Moderated

Swfs embedded in an html will not play when opened locally.

Aug 30, 2012 12:37 PM

Tags: #problem #cs5 #text #swf #button #actionscript #movieclip #actionscript3 #function

Hi all, this has been an issue for a while where i work but now seems to be pressing.  We make instructional animations in flash that are published online.  The way that we have standardized all the navigation within these swfs is with two buttons - forward and back -- which utilize some simple code in the first frame of an actions layer in the main timeline which references lables on various key frames throughout the movie (slide1, slide2 etc.)  This code strips the word "slide" and uses the remaining number to locate the play head on the timeline.  It also updates a counter so the user knows which slide they are on  (3/10 etc.)  (I'll attach the code at the bottom for your reference.)

 

This has worked great when we publish online but when we open the container html locally the buttons do not work and the dynamic text counter associated with it just reads # / #  .  I can see the movie, but the AS fuctionality doesn't work. We are using AS3 and publishing for Flash player 10.  I'm running Chrome but have tried all the popular browsers.

 

I am totally at a dead end.  I should point out too that im not a coder, Im a designer/animater the code was found on line and tweaked to our needs.

 

Anyway, any suggestions would be of help as I am at a dead end other then the flash player, for some reason is not reading the actionscript when its local. Thanks in advance --

 

Here is the code, Ive commented it out:

_______________________________________________

 

fscommand("allowscale", "false");

stage.quality = StageQuality.BEST;

stop();

 

 

  // Button Listeners

btnNext.addEventListener(MouseEvent.CLICK, nextSection);

btnBack.addEventListener(MouseEvent.CLICK, prevSection);

 

////////////////////////////////////////////////////////////////////// /////

function nextSection(event:MouseEvent):void {

 

var thisLabel:String = currentLabel; // gets current frame label as string

var thisLabelNum:String = thisLabel.replace("slide", ""); // cuts the leading letters off of the number

var curNumber:Number = Number(thisLabelNum); // converts that string number to a real number

 

if (curNumber < 10) {

 

var nextNum:Number = curNumber + 1; // adds 1 to the number so we can go to next frame label

gotoAndStop("slide" + nextNum); // This allows us to go to the next frame label

 

}

 

 

}

 

////////////////////////////////////////////////////////////////////// /////

function prevSection(event:MouseEvent):void {

 

 

var thisLabel:String = currentLabel; // gets current frame label as string

var thisLabelNum:String = thisLabel.replace("slide", ""); // cuts the leading letters off of the number

var curNumber:Number = Number(thisLabelNum); // converts that string number to a real number

var prevNum:Number = curNumber - 1; // subtracts 1 from the number so we can go to previous frame label

gotoAndStop("slide" + prevNum); // This allows us to go to the previous frame label

 

 

}

 

////////////////////////////////////////////////////////////////////// ////

// ENTER_FRAME event gets slide number

addEventListener(Event.ENTER_FRAME,updateCounter);

 

 

// this function will update the #/# slide counter with whatever

function updateCounter(e:Event):void{

 

var thisLabel:String = currentLabel; // again, this gets the current frame label as a string

var thisLabelNum:String = thisLabel.replace("slide", ""); // cuts the leading letters off of the number

this.counter_txt.text = thisLabelNum + " / 10";

}

 
Replies
  • Currently Being Moderated
    Aug 30, 2012 1:10 PM   in reply to Pomodu

    Is this all your code?

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 30, 2012 1:32 PM   in reply to Pomodu

    How are you testing the program?, with ctr + Intro    or    F12

     

    ctr + Intro say something the output?


     
    |
    Mark as:
  • Currently Being Moderated
    Aug 30, 2012 1:50 PM   in reply to Pomodu

    ok, then maybe the problem is the html file, have a ASP or PHP code? can you show the html code?

     
    |
    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