Announcement

Collapse
No announcement yet.

How to access a CLIKWidget inside of Symbol?

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

    How to access a CLIKWidget inside of Symbol?

    I cannot seem to get access to a CLIK text field that is grouped inside a symbol that I created as a "tab page". I have no problems getting to the same thing if it's placed on the stage by itself, but once it is part of the symbol then I get an Access none error.

    Here is the function I am using:

    Code:
    function SetCharTypeMessage(string message)
    {
    	MyCharTypeTextField = GetVariableObject("_root.MyCharTypeTextField");
    	MyCharTypeTextField.SetText(message);
    	`Log("What is in Type Message? = " $ message);
    }
    The necessary string is getting passed in just fine... My log outputs correctly. Again, this all works fine if the textfield (MyCharTypeTextField) is placed on the stage by itself. I suspect I need to change "_root." to something else to get deeper into the scene, but I don't know how.

    Any ideas?

    #2
    root.movieclipname.textfieldname

    Comment


      #3
      That's what I thought it might be but it doesn't work.. still get the access none.

      Comment


        #4
        I assume you are using a CLIK label component.

        If so, try using (this is confirmed to work):

        Code:
        var GFxObject RootMC, MyMovieClip;
        var GFxClikWidget MyCharTypeTextField;
        
        function bool Start(optional bool StartPaused = false)
        {
            super.Start();
            Advance(0);
        
            RootMC = GetVariableObject("_root");
            MyMovieClip = RootMC.GetObject("mymovieclip");
            MyCharTypeTextField = GFxClikWidget(MyMovieClip.GetObject("mycliklabel", class'GFxClikWidget'));
        }
        
        function SetCharTypeMessage(string message)
        {
            MyCharTypeTextField.SetString("text", message);
            `Log("What is in Type Message? = " $ message);
        }
        This assumes the following hierarchy exists in the Flash file:

        _root.mymovieclip.mycliklabel

        Comment


          #5
          Hi Matt,
          I picked this up again and am not see the correct result. I am still not getting the text to change. I'm a little confused on how your example is setup because of the use of 'MyMovieClip' in different places. Is MyMovieClip different than mymovieclip?

          If so then my hierarchy, as you mentioned, is this:

          The swf movie(_root) -> the symbol that used as a "tab page" that holds the label (mymovieclip) -> the label in the symbol (mycliklabel).

          Comment


            #6
            Yes The UnrealScript GFxObject MyMovieClip is different than the Flash instance name mymovieclip. The code I've given you works on my end. So I'm not sure what you're missing. You are using an actual CLIK label component? Or just a Flash text field?

            Comment


              #7
              I'm using an actual CLIK Label. I wonder if it has something to do with how I am using the Symbol? I'm loading it into a ViewStack as a "tab page".

              Comment


                #8
                That likely has something to do with it. I'm guessing its a scope issue.

                Comment


                  #9
                  Ok, I am logging every step of the way and everything seems to work until I get to the Symbol that houses the label. That is where I am getting the access none. If I remove that symbol then it all works. So I'm guessing I am not referencing it properly.

                  If I reight click on it in the Library and select 'Properties' I am using the 'Identifier' as the name in UScript. It just so happens that for the Symbol, the Linkage Identifier and Name are the same. Could that be the issue?

                  Comment


                    #10
                    Typically, you don't use the linkage identifier in UnrealScript - if the item is already on the stage. You use the instance name, which is set in the properties of the object on the stage. However, if the item isn't on the stage, you would need to add it using the linkage identifier with something like this:

                    Code:
                    var GFxObject     MyMovieClip;
                    MyMovieClip = GetVariableObject("_root.MyFlashMovieClip"); 
                    MyMovieClip.AttachMovie("LinkageIdentifierName", "NewMovieClipName");
                    This code would create a new movie clip called 'NewMovieClipName' using the library movie clip with the linkage ID of 'LinkageIdentifierName' inside of MyMovieClip (which exists on the stage at runtime with an instance name of 'MyFlashMovieClip').

                    In this case, if the CLIK label were inside this new movie clip, the hierarchy would be:

                    _root.MyMovieClip.NewMovieClipName.MyClikLabel

                    Anyway - the problem is that your movie clip either doesn't exist, OR you are not using the correct path reference. That's why you're getting access none.

                    Comment


                      #11
                      I still can't get this to work with the label inside of a symbol so I am going to start over and rework the design by loading in the "tab pages" as a separate movie instead of as a symbol.

                      Comment


                        #12
                        While moving some stuff around I did finally get this to work. I had to initialize each of the widgets using WidgetBindings in the symbol that I wanted to effect from UScript. I figured out that since I am setting up feyframes on te timeline for each screen, then using gotandplay to move between them, that the widgets were not being seen on anything but the first frame of the time line. If it was on the first frame then good to go... anything else and there wasn't any way to get to it.

                        Anyway, all is good now. Thanks for the help Matt.

                        Comment

                        Working...
                        X