A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: passing flashvars; can't edit loaded swf or determine how it gets the vars

  1. #1
    Junior Member
    Join Date
    Apr 2009
    Posts
    5

    Unhappy passing flashvars; can't edit loaded swf or determine how it gets the vars

    Hi-

    My company uses a Flash driven activity engine to deliver various types of quizzes and media and such to students. The engine itself is kind of old; originally developed in 2004 or 2005; we inherited it from another company we bought. It reads XML workflows to deliver the different types of content in different configurations to the user. Basically it is a chain of swfs that load each other, and in turn load various xml and media.

    ANYWAY, it uses SWFObject and Flashvars to allow loading at different "layers." Meaning one can bypass the splash screen and directly access an individual workflow or question directly. We don't currently have access to the FLA from which this was created, and now, due to hardcoded branding stuff, we have to load the primary swf through another swf to block it out.

    My problem is this: the loader swf (start.swf) is absorbing the flashvars and they aren't being passed to the primary swf (shell.swf). I can't edit shell.swf, so I have to figure out a way to get start.swf to pass the flashvars to shell.swf as if shell.swf was getting them directly from the javascript. I'm not so worried about this, found lots of various solutions, but I can't for the life of me figure out how shell.swf is getting the flashvars. So I can't figure out what to pass to shell.swf until I know how shell.swf is coded to access the variables.

    I used SWFDecompiler to break down shell.swf and can't seem to find any reference to _root.myVar or _level0.myVar or Application.application.parameters.myVar or root.loaderInfo.parameters.myVar. I've also tried using Cheat Engine and some Flash Trainers to sniff out where the variables are being assigned, but I've run out of things to look for. The only place in the AS where I see the flashvars referenced can be seen here: http://f1shw1ck.com/as/__Packages.hmfm.App.html (flashvars are: subsecid, src, layer, folder_path, and loc). However, I only have a limited understanding what is happening here.

    This is a tall order I know, but I feel like I've exhausted all the resources on the web and the limits of my current understanding of Flash and AS. Any help or suggestions greatly appreciated!

    Flash activity engine: http://*******.com/dl99kp
    FAE using flashvars: http://*******.com/c2mxhc
    FAE using loader (start.swf): http://*******.com/dfjf3x
    start.swf: http://f1shw1ck.com/as/start.fla

  2. #2
    Senior Member
    Join Date
    Nov 2001
    Posts
    1,145
    To have start.swf pass the flashvars to shell.swf, you assign the vars to the object that contains the swf.

    _root.container.shellWrapper is what shell.swf is loaded into and _root is where the flashvars are. Pass the vars to the object that will hold shell.swf:

    _root.container.shellWrapper.subsecid = _root.subsecid;
    _root.container.shellWrapper.src = _root.src;

    loadMovie("shell.swf", "_root.container.shellWrapper");

    The vars will be available to the loaded swf.

  3. #3
    Junior Member
    Join Date
    Apr 2009
    Posts
    5
    Thanks, wasn't able to get this to work by adding

    _root.container.shellWrapper.subsecid = _root.subsecid;
    _root.container.shellWrapper.src = _root.src;

    but thanks anyway. I think the function aShell is the holder, but I don't see how that pass to that one.

  4. #4
    Junior Member
    Join Date
    Apr 2009
    Posts
    5

    Question

    maybe _root.container.aShell.subsecid = _root.subsecid; ?

  5. #5
    Senior Member
    Join Date
    Nov 2001
    Posts
    1,145
    I don't think you can change those vars after the swf has loaded - they have to be there when the swf loads.

    Try setting _lockroot on the holder clip:
    _root.container.shellWrapper._lockroot = true;

    I think you can put a bar over the top of the swf using dhtml. That way you could use the old pages that work. You'd just be adding new javascript and divs to the working pages.
    Last edited by moot; 04-29-2009 at 12:07 AM.

  6. #6
    Junior Member
    Join Date
    Apr 2009
    Posts
    5
    Yeah, I've been trying to use dhtml and javascript to cover the bar... but I'm now having trouble understanding the way the various browsers use min-height... I'll post some of my explorations a little later...

  7. #7
    Junior Member
    Join Date
    Apr 2009
    Posts
    5

    Angry

    so, I've also getting some help over here: http://www.tek-tips.com/viewthread.c...1541423&page=1

    I feel like the solution must be somewhere in between the two lines of assistance I've been getting.

    I just tried:

    Code:
    _root.container.shellWrapper._lockroot = true;
    _root.container.shellWrapper.pShell.subsecid = _root.subsecid;
    // Load shell.swf into empty movie clip
    loadMovie("shell.swf", "_root.container.shellWrapper");
    blah blah blah
    and my new tact is to do something like:
    Code:
    // Load shell.swf into empty movie clip
    var loader:MovieClipLoader = new MovieClipLoader();
    loader.addListener(this);
    
    function onLoadInit(_root:MovieClip) {
    _root.container.shellWrapper._lockroot = true;	
    _root.container.aShell.subsecid = _parent.subsecid;
    }
    
    loader.loadClip("shell.swf", "_root.container.shellWrapper");
    var startingYPos = 577;
    var smallestStageHeight = 538;
    var posOffset = Stage.height - startingYPos;
    // Position movie clips
    _root.container._x = 0;
    _root.container._y = 0;
    _root.container.shellWrapper._x = 0;
    _root.container.shellWrapper._y = 0;
    _root.container.footerPatch._x = 137;
    _root.container.footerPatch._y = startingYPos;
    stageListener = new Object();
    // If window is resized, move patch to follow bottom of window
    // and stay in position over logo
    stageListener.onResize = function() {
    	// Don't move above this position
    	if (Stage.height >= smallestStageHeight) {
    		_root.container.footerPatch._y = Stage.height - posOffset;
    	} else {
    		_root.container.footerPatch._y = smallestStageHeight - posOffset;
    	}
    }
    Stage.addListener(stageListener);
    but I still can't seem to pass the damn flashvars.

    As far as DHTML goes, I'm having trouble with the way the various browsers implement min-height... the bar I'm trying to cover only appears after the viewport is a certain height and then simply a certain distance from the bottom of the viewport as the browser window expands...

    This is SO frustrating. I hate Flash.

  8. #8
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    I'm new with this of passing variables from external location as swf's, html, java, text file so I can't help how I wish to...but did you try other SWF decompilers? There a few, and good ones, that decompile the whole swf, and you can see everything inside , graphics, movieclips, scripts, variables. Good luck

  9. #9

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