A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: External Buttons

  1. #1
    Junior Member
    Join Date
    Mar 2016
    Posts
    4

    External Buttons

    Hi all,

    So, I have an external .swf with buttons that are loaded in to my ui using this code:

    loadMovie("IMS_Buttons_v1.swf", "buttonsContainer");

    And the buttons within are supposed to interact with a different external movie that are loaded in to the ui using this code:

    loadMovie("IMS_Master_v1.swf", "masterContainer");

    And yet, the code on the buttons don't seem to be working:

    buttonsContainer.zoom1.onRelease = function() {
    _root.masterContainer.IMS_BG._xscale = _root.masterContainer.IMS_BG._xscale + 50;
    _root.masterContainer.IMS_BG._yscale = _root.masterContainer.IMS_BG._yscale + 50;
    }

    buttonsContainer.zoom3.onRelease = function() {
    _root.masterContainer.IMS_BG._xscale = _root.masterContainer.IMS_BG._xscale - 20;
    _root.masterContainer.IMS_BG._yscale = _root.masterContainer.IMS_BG._yscale - 20;
    }

    buttonsContainer.zoom2.onRelease = function() {
    setProperty(_root.masterContainer.IMS_BG,_x,629);
    setProperty(_root.masterContainer.IMS_BG,_y,400.50 );
    setProperty(_root.masterContainer.IMS_BG,_xscale,1 00);
    setProperty(_root.masterContainer.IMS_BG,_yscale,1 00);
    }

    What am I doing wrong?

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    You would really need to attach your files for us to see what and where, maybe make a trial skeleton version and attach them.
    it's just a path issue I assume.

    I don't have time right now (work) but maybe somebody else can help you in the meantime

  3. #3
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Your buttons will not work as you are assigning the button commands before the clip has had time to load (hence nothing for it to associate with), try using the movieClipLoader for this as it has much much control over what and when thins are loaded.

    PHP Code:
    var buttonTarget:MovieClip buttonsContainer;
    var 
    buttonLoader = new MovieClipLoader();
    var 
    buttonListener:Object = new Object();

    buttonLoader.addListener(buttonListener);
    buttonLoader.onLoadStart = function(buttonTarget):Void 
    {
        
    trace("load buttons started");
    };
    buttonLoader.onLoadProgress = function(buttonTarget):Void 
    {
        
    trace("load buttons loading");
    };
    buttonLoader.onLoadComplete = function(buttonTarget):Void 
    {
        
    trace("load buttons complete");
    };
    buttonLoader.onLoadInit = function(buttonTarget):Void 
    {
        
    trace("load buttons initiated");
        
    loadMaster();
    };

    buttonLoader.loadClip("IMS_Buttons_v1.swf",buttonTarget);

    function 
    loadMaster():Void
    {
        var 
    masterTarget:MovieClip masterContainer;
        var 
    masterLoader = new MovieClipLoader();
        var 
    masterListener:Object = new Object();

        
    masterLoader.addListener(masterListener);
        
    masterLoader.onLoadStart = function(masterTarget):Void 
        
    {
            
    trace("load master started");
        };
        
    masterLoader.onLoadProgress = function(masterTarget):Void 
        
    {
            
    trace("load master loading");
        };
        
    masterLoader.onLoadComplete = function(masterTarget):Void 
        
    {
            
    trace("load master complete");
        };
        
    masterLoader.onLoadInit = function(masterTarget):Void 
        
    {
            
    trace("load master initiated");
            
    activateButtons();
        };

        
    masterLoader.loadClip("IMS_Master_v1.swf",masterTarget);
    }

    function 
    activateButtons():Void
    {
        
    buttonsContainer.zoom1.onRelease = function()
        {
            
    masterContainer.IMS_BG._xscale masterContainer.IMS_BG._xscale 50;
            
    masterContainer.IMS_BG._yscale masterContainer.IMS_BG._yscale 50;
        };


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center