Announcement

Collapse
No announcement yet.

[SOLVED] Invoke ActionScript function not working

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    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)

    Comment


      #17
      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:

      Code:
      exec function ShowMyMap(){
        toggleMyMap();
      }
      Now in the toggleMyMap function:

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

      Code:
      var vector playerPosition;
      var GFxObject RootMC, PointerMC;
      function launch(vector pos){
         Start();
         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);
      }
      
      defaultproperties{
          MovieInfo = SwfMovie'UIs.GFX.map'
         //and other stuff about default properties, nothing important
      }
      And then, in my flash file, in a layer called actions:

      Code:
      import flash.external.ExternalInterface;
      ExternalInterface.call("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?

      Comment


        #18
        that way looks perfectly fine to me.

        Comment


          #19
          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!

          Comment


            #20
            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.

            Comment

            Working...
            X