I suppose one workaround is to use the <iframe/> tag instead of <embed/> tag because that way the url generated to "view source" will be relative to the hosting website and not the embedding website. But still isn't there a way to be explicit about the location of the source code by using the embed tag?
1 person found this helpful
You can set the viewSourceURL in the application tag.
After you pointed it out, I realized that when I asked FlashBuilder to publish my code it added that property to my main applicaiton file.
There are still a few caveats before it simply works, here they are:
1) If the viewSourceURL is not set as an attribute/property of the application tag, setting it later in an event handler, such as the one for applicationComplete, does not add it to the context-menu so one must still have the original attribute/propety in the application tag. Setting the viewSourceURL again in a handler, will then update it correctly.
2) How to get build the host URL?
Well I found the answer to that here: http://www.taterboy.com/blog/2009/01/swf-based-relative-urls-in-flash-or-flex/ and throwing that into the applicationCompleteHandler works great.
protected function applicationCompleteHandler(event:FlexEvent):void
var swfURL:String = FlexGlobals.topLevelApplication.loaderInfo.url;
swfURL = swfURL.substr(0, swfURL.lastIndexOf("/") + 1)
var tempDom:Array = swfURL.split("/");
var domURL:String = tempDom.slice(0,3).join("/") + "/";
viewSourceURL = domURL+ "srcview/index.html";