I made a separate post on the way I solved this problem because it is useful for more than just localizing text.
Find it here: http://forums.epicgames.com/threads/...initialization
Announcement
Collapse
No announcement yet.
gotoAndPlay - textFields clear out. How to reinitialize?
Collapse
X
-
Zitheral repliedNevermind... that is a weird way of sharing that link o.O
thank you though
Leave a comment:
-
Matt Doyle repliedhttp://udn.epicgames.com/Three/Scale...source sharing
Just remove the s in https.
Or go here:
https://udn.epicgames.com/Three/ScaleformImport
Then click on Resource Sharing.
Leave a comment:
-
Zitheral repliedIs there a good tutorial for importing widgets and other assets from another SWF file? I haven't run across one like that yet... Still so much to learn.
Leave a comment:
-
Matt Doyle repliedOne good solution would be to place all the disabled widgets inside a movie clip. Then, use the following code (also inside that movie clip) to send a WidgetInitialized() event on the movie clip itself. At which point, you can set the text of those disabled widgets, as they will obviously exist if the movie clip exists. Be sure to include a case for the movie clip in your UnrealScript.
AS2 code:
Code:if( _global.CLIK_loadCallback ) { _global.CLIK_loadCallback(this._name, targetPath(this), this); }
Leave a comment:
-
Zitheral repliedWell... these buttons are disabled in ALL frames (for now) The problem I'm having is that as I move in and out of labeled frames with gotoAndPlay, disabled CLIK buttons don't fire off a WidgetInitialized event as far as I can tell. That is where I'm catching the menu "page" transitions so I can localize the text. I found a "workaround" of setting the text from the WidgetInitialized events other widgets on the same frame, but that is hacky and I have no idea what will happen if the order the widgets are processed in changes. It could cause indeterminate behavior -- it is a bit of a kludge but it sorta works for now...
Leave a comment:
-
Skalamondre repliedHonestly I thought the "export in frame 1" checkbox was supposed to address this issue but it doesn't seem to work this way. Did you try initializing them in frame 1 but keeping them disabled until the frame needed? I think I had my share of issues with this problem too.
Leave a comment:
-
Zitheral repliedI do still have a problem with getting no WidgetInitialized events from disabled CLIK widgets. Is there another way to do this?
You might say "Why do you have disabled buttons on your menu?" They are for (currently) unimplemented features and will exist for things like DLC that the user hasn't purchased so they know it is available.
Leave a comment:
-
Zitheral repliedOooooo I finally figured it out. After taking the time to write all of this. Here is the problem:
Often, it is useful to have a callback when certain widgets are initialized on the timeline. This is especially important when widgets do not exist on the first frame! Since ActionScript has no knowledge or a widget until its first appearance on the timeline, we have added a WidgetInitialized() callback that gets fired when ActionScript creates a widget.
Basically, you can't initialize your reference to GFxClikWidget in function Start () for widgets that show up on frames other than Frame 1. You need to wait until the movie advances to the Frame containing the widget before you can create your reference to it.
In other words, you can't do this:
Code:Label_Button_OM_Back = GetVariableObject("_root.button_OM_Back.textField");
Leave a comment:
-
Zitheral started a topic gotoAndPlay - textFields clear out. How to reinitialize?gotoAndPlay - textFields clear out. How to reinitialize?
What is the proper way to reinitialize CLIK widgets when jumping around in a flash file?
In my menu, I have the CLIK widgets set to a blank value for the text labels.
In my unreal script, I do this for each button label in the Start function:
Code:// Setup Main Menu Label_Button_MM_Play = GetVariableObject("_root.button_MM_Play.textField"); Label_Button_MM_Play.SetText(Label_Button_MM_Play_loc); //This is localized text
In my flash file, I have my menu pages laid out in labeled frames. So when you click options, it jumps to the Options label with gotoAndPlay.
After jumping with gotoAndPlay, any buttons I have in the options frame (which happens to be frame 20) don't have text labels. For reference, the CLIK widget doesn't exist on Frame 1 (in otherwords, I didn't put it there and hide it) it begins existing only on Frame 20 (Options label)
When I hit the back button on my Options menu to jump back to the Main Menu frame (frame 1) all the text labels are gone, even though they were there when the flash file started.
If I put this in the WidgetInitialized switch block:
Code:Label_Button_MM_Play.SetText(Label_Button_MM_Play_loc);
I also can't get a CLIK widget that is created in frame 20 to have text on it at all... so I'm doing something wrong. Even if I follow the steps above for the CLIK button on Frame 20, I still get "textfield"
I hope this isn't too confusing. The short version is -- I think I'm not reinitializing widgets properly after a gotoAndPlay. What is the right way to catch these events and reset my localized text on buttons?
I've read the block on localization here: http://udn.epicgames.com/Three/Scale...0and%20Binding
And that is essentially what I'm doing but it doesn't work on A) Disabled CLIK widgets (I'm guess they don't fire off widgetinitialized events?) and B) Widgets that first show up on Frames after 1.
I've got visible and EnableInitCallback turned on for all of these buttons.Tags: None
Leave a comment: