Posted by ggerstein in SWF Studio V3 on Feb 26 2008, 12:56 pm

Hi,

New to this forum. I am using SWF Studio Version 3.4 and was asked to find out if we can use the application to layer high light boxes over a browser interface. The browser need to be an actual browser that the user can interact with. I have been able to create the browser window and load an html file that was local using the startdir moniker in the ssCore.Browser.setURL() method. That took a little figuring out, but it is working fine. However when I try to place a movie clip to display like a high light box over an area of the browser window, the movie clip always appears behind the browser window. Is there any way to handle depth management using the ssCore.Browser API or can you load multiple swf files into to the application in a some way so it displays movie clips over the browser window?

Here is the code that worked so far, but the movie clip always shows up in the back. I am on Windows XP using SWF Studio version 3.4 with Flash Studio 8 and Actionscript 2 code. Thank you in advance for any ideas.

I went ahead and attached the fla file and a text file that is actually the html file that gets loaded here. I guess we can't upload html files so you have to change the extension to .html instead of .txt, but you will see it is a really simple html file.

//initialize ssCore
ssCore.init();
ssDefaults.synchronousCommands = true;

//set up buttons to call url for browser

var openButton:Button = this.openURLBtn;
var traceMovieButton:Button = this.traceMovieBtn;
var highlight_MC:MovieClip;

//create initial browser object

ssCore.Browser.setBrowser({browser:'IE'});
ssCore.Browser.setPosition({x:10, y:40});
ssCore.Browser.setSize({width:860, height:500});

//on button press load url asynchronously so you can trace errors
openButton.onPress = function()
{
ssCore.Browser.setURL({url:"startdir://test.html"},{callback:browserSetURLHandler,scope:this,sync:false},{errorCallback:errorHandler});
ssCore.Browser.open();

//try drawing a highlight movie clip over the browser display area

drawHighlight();
}

/*
call back functions omitted for brevity
*/

//draws the movie clip to display over browser window
function drawHighlight()
{
highlight_MC = _level0.createEmptyMovieClip("highlight_MC",1000);
highlight_MC.beginFill(0x990000,50);
highlight_MC.moveTo(0,0);
highlight_MC.lineTo(500,0);
highlight_MC.lineTo(500,500);
highlight_MC.lineTo(0,500);
highlight_MC.lineTo(0,0);
highlight_MC.endFill();
}

/*
Tried a trace function for all objects in the root movie to see how it was handling the browser window. It does not appear in the properties for the root movie so how is it handling the browser window display relative to the root swf?
*/

function traceMovie()
{
for(prop in this)
{
ssDebug.trace(prop + ":" + this[prop]);
}
ssDebug.trace("Tracing Reserved");
for(prop in this._level0.reserved)
{
ssDebug.trace(prop + ":" + this._level0.reserved[prop]);
}
}

attachments: BrowserLoadTest.fla   test.txt  


Posted by mbd in SWF Studio V3 on Feb 26 2008, 02:40 pm

Check out this explanation (2nd post):
http://www.northcode.com/forums/showthread.php?t=8720

For your scenario, the best option I can think of is to use SWF Studio's JScript implementation to control the browser DOM. Using a JScript module (see ssCore.Script and this post) you can access the Document Object Model of the browser object. You can call JavaScript that exists on the page, and otherwise manipulate HTML elements.

The only other option is to create other instances of the Flash Player as ActiveX objects and position them where you need. The drawbacks are that those objects are solid rectangles (no transparency or irregular shapes) and the SWF contained can only talk to the main SWF through LocalConnection, since it's running in a different instance of the Flash Player.


Posted by ggerstein in SWF Studio V3 on Feb 26 2008, 03:23 pm

Hey Derek,

I appreciate your fast feedback. That was my understanding and I did look at the jscript api as an option. The difficulty with that was that the file I am bringing in is pretty complex because it is an interface for a multi-source player with a lot of interactive features. I was hoping to avoid the problem of having to go into that code and risk breaking functionality. By modifiying the DOM for example I could be breaking some of the existing features. I went through the jscript tutorials though on the Microsoft developer site because I really haven't done any jscript development. They are really straight forward if you have used any javascript at all even though they explicitly declare that jscript has "nothing to do with javascript". Thank you for the confirmation that I was on the right track however. This was pretty much where I was headed next.