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";
}
From Flash, if I press ctr+enter or F12 the swf pops up it plays fine.
The only problem is when I have it embeded in an html page and test the page in a browser. I can see the swf and the animation will play in the first frame, but the counter and the forward and back buttons do not work. But, if i upload that same html page and the embedded swf to an external server, it also loads and plays fine.
I think I may have found something. In IE, I can right click and choose global settings, then in the advanced tab i can add the folder where the swf resides. In Chrome I'm still working out how to add a trusted location setting as it seems to take me directly to the adobe site. Anyway. progress. Thanks so much for the assisstance though. So much to learn with this programme.
Cheers
M
North America
Europe, Middle East and Africa
Asia Pacific