• Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
    Dedicated community for Japanese speakers
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
    Dedicated community for Korean speakers
Exit
0

Swf within a Swf scoring issue

Guest
Apr 12, 2012 Apr 12, 2012

Copy link to clipboard

Copied

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.

TOPICS
ActionScript

Views

919

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Apr 13, 2012 Apr 13, 2012

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 

Votes

Translate

Translate
LEGEND ,
Apr 12, 2012 Apr 12, 2012

Copy link to clipboard

Copied

Are you sure the player swf is loading?  Where is the code you show located?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

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 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

I'm a moron. I did have a stage reference in my other project file. That is most likely what was causing the issue. Thanks a million Ned!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

You're welcome.  I have not worked with the TLFTextfields at all. I have only heard in these forums that they shouldn't be used unless there is a need for some functionality they provide that the 'classic' (aka 'more reliable') textfields don't provide.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

LATEST

I had no clue what the difference was, so thats good to know.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines