Need help with Lectora to Flash (update variable)

clarkkane
clarkkane Community Member Posts: 3
Hello



i am working with lectora version 9 and a flash(swf) on a page

I am using an action with Flash command/ set variable to update a variable in flash but it doesnt work



when i do a GotoLabel command it does work so i suppose something in my as2 code is wrong



anyone has an example they did that you could share so i can find out what i am doing wrong



in flash i ahve defined the variable like this:



var currentpage:string = "ip0";



any help is appreciated,



thanks

Comments

  • timk
    timk Community Member Posts: 1,207 ♦ Idol ♦
    I've tested what you describe with no problems.



    The command setting of the Flash Command should be:



    Name: nameOfTheFlashVariable

    Value: can be a number, a string or a Lectora variable, e.g. VAR(CurrentPageName)



    If that isn't working, maybe your Flash variable is in a MovieClip?



    You can set the Flash Command setting to:



    Name: nameOfTheMovieClip.nameOfTheFlashVariable



    Are you sure the Flash variable isn't updated or do you want to display the updated value in the animation and the display isn't updated? You would need an onEnterFrame or a similar way to constantly check for the updated variable value.



    Tim
  • clarkkane
    clarkkane Community Member Posts: 3
    okay, i tried what you said but without success. i even tried it online(server)



    let me explain what i need to do: in lectora i want to use the flash command to modify a variable in flash, then in flash at the 1st frame i have a script that declares the variable and tells flash that on enter frame check the function that sees if the variable has changed, if it has changed then make a movieclip on the timeline go to frame2



    i am using a string variable for this.



    any suggestions?



    Thanks
  • timk
    timk Community Member Posts: 1,207 ♦ Idol ♦
    Here's what i tested successfully:



    1. In Flash



    var currentpage:string = "ip0";



    this.onEnterFrame = function(){



    if (currentpage == "ip1"){



    this.your_mc.gotoAndStop(2);



    }

    }



    2. In Lectora



    On:

    Action: Flash command

    Target: your.swf

    Command: Set variable

    Name = currentpage

    Value = ip1



    Tim
  • clarkkane
    clarkkane Community Member Posts: 3
    @timk 55999 wrote:
    Here's what i tested successfully:



    1. In Flash



    var currentpage:string = "ip0";



    this.onEnterFrame = function(){



    if (currentpage == "ip1"){



    this.your_mc.gotoAndStop(2);



    }

    }



    2. In Lectora



    On:

    Action: Flash command

    Target: your.swf

    Command: Set variable

    Name = currentpage

    Value = ip1



    Tim


    All of this worked perfectly :))))))



    thanks a lot for taking your time to help.