No announcement yet.

[SOLVED] Invoke ActionScript function not working

  • Filter
  • Time
  • Show
Clear All
new posts

    Originally posted by Beakman View Post
    What a misconception by my side! Anyway, I have tried that, but it returns 'none'. I tried to follow some tutorials I found googling for a while, but all of them are using FSCommands and CLICK objects. The first one is not recommended for use in production, so I prefer to learn how to use uscript/ascript properly. I don't use the second one because I want to use my own objects, functions, etc.

    Thanks for the help anyway
    Also I've sometimes run into problems with GetObject, so I always do like this:
    GFxObject HealthMC;
    HealthMC = GetVariableObject("_root.health_mc");
    using the full path.

    Have you ever done this before? otherwise it could be good training just to put a movieclip in the root of the flash and try to get it without it being none first. One problem that often is stumbled upon is that the movieclip doesn't exist at that point in the timeline (it might not exist until frame X in an animation, or it might get spawned later)


      Finally I get the result I want, but in a weird way.

      First of all, in mi DefaultInput.ini I bind the letter "M" with mi exec function ShowMyMap(). I placed this function in my gameinfo class. The function looks like this:

      exec function ShowMyMap(){
      Now in the toggleMyMap function:

      var LsGFxMovie MapMenu;
      var vector pos;
      function toggleMyMap(){
         if (MapMenu !=none && MapMenu.bMovieIsOpen)
             MapMenu = new class'LSGFxMovie'
      Later, in my LsGFxMovie, a new class I create, extending from GFxMoviePlaye,where the spaguetti code begins:

      var vector playerPosition;
      var GFxObject RootMC, PointerMC;
      function launch(vector pos){
         playerPosition = pos;
       //I call this function from my swf file
      function doTheMagic(){
         RootMC = GetObjectVariable("_root");
         PointerMC = RootMC.GetObject("pointer"); //this time it gets the reference to the object
         PointerMC.SetPosition(playerPosition.x, playerPosition.y);
          MovieInfo = SwfMovie''
         //and other stuff about default properties, nothing important
      And then, in my flash file, in a layer called actions:

      import flash.external.ExternalInterface;"doTheMagic");
      So, in the end, what I'm doing is call Gameinfo from an exec function, from there call a GFxMoviePlayer class wich opens the swf file, and in the first frame of this I call a function of the GFxMoviePlayer class to make what I want to do. I mean, you can call it everything but elegant, that's for sure.

      What do you think? Can you bring me an idea to improve this, from the moment that, for who-know-what-reason, the straight way didn't work for me?


        that way looks perfectly fine to me.


          Sure? Thank you! You know much more about scaleform than me, so if it looks fine for you, it looks perfect for me. Thank you very much for your help. And thanks to Charleon too!


            My philosophy is - If it works for you, and you don't have any performance problems, then go with it. There's more than one way to do most tasks.