Results 1 to 7 of 7
  1. #1

    Question Strange ActionScriptVoid Problem

    Hey Everybody, I've got a rather strange problem, here goes:

    I'm running this code inside a custom GFxMoviePlayer class:
    Note: "testLabel" is the instance name of a label that simply says "--test--"
    Code:
    function Init(optional LocalPlayer player)
    {
       super.Init(player);
    
       Advance(0);
       Start();
       RootMC = GetVariableObject("_root");
       `log("--------------------------------------------------------should've called debug in AS");
       RootMC.ActionScriptVoid("DebugDisplay");                   //LINE 1
       ActionScriptVoid("DebugDisplay");                              //LINE 2
       `log(GetVariableObject("_root.testLabel").getText());    //LINE 3
    }
    Which is attached to a FLA running AS 2.0 and exporting using Flash Player 8.0 (also set up to show traces in UDK log):
    Code:
    function DebugDisplay()
    {
    	trace("-------------------- in DebugDisplay()");
    }
    So the log should read
    "--------------------------------------------------------should've called debug in AS"
    "-------------------- in DebugDisplay()" | (from LINE 1)
    "-------------------- in DebugDisplay()" | (from LINE 2)
    "--test--" | (from LINE 3)



    Instead, it reads:
    ScriptLog: --------------------------------------------------------should've called debug in AS
    DevGFxUI: Error: Can't find method '_level0.DebugDisplay' to invoke.

    ScriptWarning: Accessed None
    CustomGFxMoviePlayer Transient.CustomGFxMoviePlayer_0
    Function CustomGame.CustomGFxMoviePlayer:Init:0137
    ScriptLog:

    Because line 1 (from the unrealscript source) works when called from another function in the same FLA, I know the first error is from line 2 in the unrealscript source (which means since it's not throwing an error for line 1, it's finding the function called in line 1). But why doesn't it print out? the other two errors have be baffled; can anybody shed some light on this?

    Thanks

  2. #2

    Default

    Shameless bump...

  3. #3
    MSgt. Shooter Person
    Join Date
    Apr 2011
    Posts
    227

    Default

    Hi,
    as far as I know, traces are not written into the udk log.

    edit: It is possible, but you have to change the config: http://forums.epicgames.com/threads/...8#post27947388

    Also, try
    Code:
    ActionScriptVoid("_root.DebugDisplay");
    greetings
    Last edited by FTC; 07-16-2012 at 04:10 AM.

  4. #4

    Default

    Hey FTC, thanks for the reply

    Maybe I didn't make myself understood- I already set up my logs to print traces from the same exact post, and I can confirm its working when a function in the FLA class the DebugDisplay function.

    It has to be a setting or something- some reason that breaks the link from _root to the frame I'm on

    Important: I should mention, I'm attempting to call a function on frame 10, but I can confirm that I'm in frame 10 by what is shown in-game. Could it be that "_root" is retrieving the 1st frame's functions, and not the 10th? If so, how would I fix this?

  5. #5
    Skaarj
    Join Date
    Dec 2011
    Location
    India
    Posts
    3

    Default

    Quote Originally Posted by goopyay View Post
    Hey FTC, thanks for the reply

    Maybe I didn't make myself understood- I already set up my logs to print traces from the same exact post, and I can confirm its working when a function in the FLA class the DebugDisplay function.

    It has to be a setting or something- some reason that breaks the link from _root to the frame I'm on

    Important: I should mention, I'm attempting to call a function on frame 10, but I can confirm that I'm in frame 10 by what is shown in-game. Could it be that "_root" is retrieving the 1st frame's functions, and not the 10th? If so, how would I fix this?

    The problem is that when ur moving from frame1 to frame 10, it takes some time to do this. what i would suggest is get a callback from flash so that you are sure that your movie is on frame 10 and then use ActionScriptVoid("DebugDisplay").
    To confirm this you could write the same function inside flash on frame 1 and trace something else. with this you would know that which frame your flash movie is in when you are calling the ActionScriptVoid().

    Ketan,
    Trine Games

  6. #6
    MSgt. Shooter Person
    Join Date
    Apr 2011
    Posts
    227

    Default

    Are 1 and 10 keyframes, or is 1 a key frame and 10 just an extended frame? The later should not cause this problem. But I agree, you may want to try a simpler setup to check whether things are working at all.
    However, judging from this:
    Code:
       Advance(0);
       Start();
    It seems your flash movie is on frame 1, rather than 10?

    You could also upload your fla/.uc so we can take a look.

    greetings

  7. #7

    Default

    Your problem is simple. You are trying to call a function on frame 10 before the playhead is even there. Do not put anything in your INit() function that does not happen on frame 1. It won't work if you do.

    You'll need to create a CLIK widgetInit callback on frame 10 to let UnrealScript know you are there. Then, you can call the function you want within the WidgetInitialized switch statement for that callback.


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.