Results 1 to 3 of 3
  1. #1

    Question Can you dynamically clone movie clips?

    I'm creating a ScaleForm menu at the moment that would be a lot easier if it was data-driven.

    So say my ScaleForm has some movie clip somewhere (that has some text, an icon, etc) to represent an ability. For each ability in the game I dynamically set the text, icon etc to the data for the ability. If I have a menu which lists all the abilities in the game, it would be nice to be able to make this data-driven, rather than hard-coding each ability into the flash file. This would also save a lot of re-work when re-ordering, adding or removing new abilities.

    In looking through GFxMoviePlayer.uc, I see:
    native function GFxObject CreateObject(string ASClass, optional class<GFxObject> type, optional array<ASValue> args);

    This looks close to what I want - except I'd have to then define everything in ActionScript. Can I just clone an existing movie clip, giving it a new name? So say my flash file has a template movie clip, can I then clone it as necessary, and give the clones the data-driven values for display?

    Otherwise I guess I'll just have to go create a ton of identical movie clips (more than I'll ever need) in the flash file, then hide those I don't need? And if abilities get re-ordered or changed, we'll just have to remember to update the menus too?

  2. #2
    MSgt. Shooter Person
    Join Date
    Sep 2008
    Posts
    77
    Gamer IDs

    Gamertag: cheesewhisk PSN ID: cheesewhisk

    Default

    What you need to do is either attach a MovieClip that exists as a blueprint in you library, or duplicate one that's already on the stage.


    Actually, I've just had a look and you can call AttachMovie on a GFxObject


    Code:
    /** Attaches a symbol to specified movie instance.  If no instance is found in this object's scope with the InstanceName, a new instance is created and returned */
    native final function GFxObject AttachMovie(string symbolname, string instancename, optional int depth = -1, optional class<GFxObject> type = class'GFxObject');

  3. #3

    Default

    Ah, interesting. I skipped over that function in GFxObject, because the name didn't sound like anything to do with duplication. Should have read ALL the comments xD.

    I'll give it go and say if it works out.


 

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.