I've created a flash file (my project) that is loaded into another swf (our player) file on our site. When I test the project file on my computer the scoring displays correct at the end of the lab. When it is loaded into our swf player on the site the score doesn't display. I'm at a lose for why this is happening. If someone could provide me with some direction I would be very thankful.
// Declare variable
var numOfCorrect:int = 0;
// Every time someone click the correct selection it adds one to the score
function correct(e:MouseEvent):void{
numOfCorrect++;
}
//I have a text box with the name yourScore
yourScore.text = numOfCorrect + " out of 5";
It is very basic code so I have no idea what is isn't working. My only guess is there is some kind of conflict once it is loaded into an external swf. What would I do in this case? Thanks.
Yes, the player seems to load fine. The project is loaded up into it exactly how it is suppose to and everything functions properly until you get to the end and the score doesn't display. The text box is completely empty. The code is on the main timeline in the actionscript layer.
I also have a project I created using the drag and drop feature. It works perfectly fine when tested on my computer. As soon as it is uploaded onto our site and loaded into our swf player it has issues. You click one of the drag and drop items and it will pick it up and it won't allow you to drop it back down.
I have done a little research online about embedding swfs within swfs and the conflicts that arrise but I haven't been able to figure anything out. Any ideas?
Since you have problems with more than one file with this player, there is something about placing the file into another that changes the environment it is depending on. Just as a for instance, if you happen to use stage references in your code, that might be a source of the proiblem when you load the file into another file's since there is only one stage... the one defined by the player file
Yeah, thats what I was thinking but I'm not using a stage reference anywhere. Is there something I can use in the code to make sure when I refer to a variable or text box in my project file that it isn't trying to pull that information from the player instead of my project file?
I seemed to have figured it out. I changed the text box from TLF Text to Classic Text and selected Dynamic Text. Also changed the Actionscript up a little.
instead of just:
yourScore.text = numOfCorrect + " out of 5");
i did:
addEventListener(Event.ENTER_FRAME, displayFinalScore);
function displayFinalScore(event:Event){
yourScore.text = String(numOfCorrect + " out of 5");
}
Not sure which of these things fixed the issue but it is working now. Thanks for the help though! Now I just need to figure out the issue with the drag and drop.
North America
Europe, Middle East and Africa
Asia Pacific