Announcement

Collapse
No announcement yet.

attachMovie and Scaleform Init Times

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

    attachMovie and Scaleform Init Times

    I have run into this problem a few times now. I always end up doing work arounds. However, it is really starting to bug me.

    When a movieclip is added to the stage (even at launch), it takes time for the scaleform components in it to load. Often, you call on a component and nothing happens, because it has yet to finish initializing.

    For instance:

    Code:
    _root.attachMovieClip("ScaleformContainerWithProgressBar",progressContainer, 1);
    _root.progressContainer.statusBar.setProgress(100,100);
    Now, this would work with default TextFields, or any default flash component. However, Scaleform widgets give you an error. Basically, by the time it executes the second line of code, the Scaleform component still is not initialized.

    Now, I know that in UnrealScript you would use WidgetInitialized. However, what if I want to do exactly what I posted above. Is that even possible?

    #2
    This code should work for you:

    ActionScript 2.0 Code

    Code:
    _root.attachMovie("ScaleformContainerWithProgressBar","progressContainer", 1);
    
    onEnterFrame = function()
    {
        _root.progressContainer.statusBar.setProgress(40,100);
        onEnterFrame = null;
        delete onEnterFrame;
    }

    Comment


      #3
      Sorry it took so long for me to reply.

      As always, your amazing Matt. Thank you so much.

      I don't even know why I didn't think of this. It makes so much sense.

      Comment

      Working...
      X