Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a symbol called MapNameText and a dynamic text field inside called "innerText".

I'm trying to make it change the text when i click on the object they're all in but it doesnt work

Relevant part of my actionscript:

var MapName:String;

this.onMouseDown = function()
{

    trace(MapNameText['innerText'].text);

    MapName= MapNameText['innerText'].text;

    switch(MapName)
    {
        case "Classic":
        this.MapNameText['innerText'].text = "Crystal";
        trace(this.MapNameText['innerText'].text);

        case "Crystal":
        MapNameText['innerText'].text = "Volcano";

        case "Volcano":
        MapNameText['innerText'].text = "Classic";
    }
}

In the output window i get "Classic" "Crystal" But the text doesn't update in my object, it's confusing me a lot and im not sure what to do

Can anyone please lend me a hand with how to fix this?

share|improve this question
add comment

2 Answers

switch(MapName)
{
    case "Classic":
    this.MapNameText.innerText.text = "Crystal";
    trace(this.MapNameText['innerText'].text);

    case "Crystal":
    MapNameText.innerText.text = "Volcano";

    case "Volcano":
    MapNameText.innerText.text = "Classic";
}
share|improve this answer
add comment
up vote 0 down vote accepted

Thanks for the reply! unfortunately that didn't resolve the issue, but after a little more tinkering a realized that i wasn't using 'Break'. It now works when i break off each case.

for those with a similar problem, this is the resolved code

switch(MapName)
{
    case "Classic":
    this.MapNameText.innerText.text = "Crystal";
    trace(this.MapNameText['innerText'].text);
    break;

    case "Crystal":
    MapNameText.innerText.text = "Volcano";
    break;

    case "Volcano":
    MapNameText.innerText.text = "Classic";
    break;
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.