Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

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

Status
Not open for further replies.
Apr 6, 2009
4
US
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: (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: FAE using flashvars: FAE using loader (start.swf): start.swf:
 
2004/5 means it's AS1/2, therefore FlashVars are just [tt]_root[/tt] variables as opposed to AS3 [tt]LoaderInfo.parameters[/tt] object. So in theory you can reference the variable "subsecid" in shell.swf from start.swf [tt]_root[/tt] timeline as [tt]_parent.subsecid[/tt]

Kenneth Kawamoto
 
So, this is what we have currently:

// Load shell.swf into empty movie clip
loadMovie("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);

How exactly should I reference it?
 
Okay, so now I have
Code:
// Load shell.swf into empty movie clip
var loader:MovieClipLoader = new MovieClipLoader();
loader.addListener(this);

function onLoadInit(_root:MovieClip) {

// pass those flashvars...	
	
}

loader.loadClip("shell.swf", "_root.container.shellWrapper");
But I can still not get the loader to pass the flashvars...

I've tried:
Code:
_root.container.shellWrapper.aShell.subsecid = _parent.subsecid;
_root.container.aShell.subsecid = _parent.subsecid;
_root.aShell.subsecid = _parent.subsecid;
_root.subsecid= _parent.subsecid;
_root.container.subsecid = _parent.subsecid;
_root.container.shellWrapper.subsecid = _parent.subsecid;
_aShell.subsecid = _parent.subsecid;
aShell.subsecid = _parent.subsecid;
_root.container.shellWrapper.aShell.subsecid = _root.subsecid;
_root.container.aShell.subsecid = _root.subsecid;
_root.aShell.subsecid = _root.subsecid;
_root.subsecid= _root.subsecid;
_root.container.subsecid = _root.subsecid;
_root.container.shellWrapper.subsecid = _root.subsecid;
_aShell.subsecid = _root.subsecid;
aShell.subsecid = _root.subsecid;

Again, in the original swf, the only reference I can find to the flashvar
Code:
subsecid
is in a function:
Code:
if (pShell.subsecid == undefined && pShell.loc == undefined) {
            welcome_mc = _loc2.createEmptyMovieClip("welcome_mc", _loc3);
            var _loc4 = new MovieClipLoader();
            _loc4.addListener(this);
            _loc4.loadClip(this.__get__folderPath() + "welcome.swf", _loc2.welcome_mc);
            this.sizeApp();
        }
        else {
            this.sizeApp();
            nav_mc.slideBarsIn("onNavBarsIn", this, 8);
        }

The beginning of the sprite says"
Code:
class hmfm.App implements hmfm.ILayer {
    var pShell, pLoadStartTime, pInitItemIdx, pLinkIdDelim, pExternalValues, pPopups, pFolderPath, pHttpHandler, pSettings, pStyleMgr, pRootLayer, pRootSrc, pGlossary, __get__dataPath, pData, pManifest, pReportNodes, pView, bgnd_mc, pAct, pActDepth, nav_mc, welcome_mc, __get__folderPath, __get__httphandler, pCurTocNode, pSearchPopup, pEmailLv, __get__glossMediaPath, __set__httphandler, __get__isEduspace, __get__mediaPath, __get__shell, __get__titleManifest, __get__titleManifestStateType, __get__view;
    function App(aShell) {
        pShell = aShell;  
blah blah blah...

Thanks for any more pointers you have!
 
I've had no luck using either one of your last suggestions, any further tips you could give me?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top