View comments | RSS feed

MovieClip._url

Availability

Flash Player 4.

Usage

my_mc._url:String

Description

Read-only property; retrieves the URL of the SWF or JPEG file from which the movie clip was downloaded.

Example

The following example displays the URL of the image that is loaded into the image_mc instance in the Output panel.

this.createEmptyMovieClip("image_mc", 1);
var mclListener:Object = new Object();
mclListener.onLoadInit = function(target_mc:MovieClip) {
   trace("_url: "+target_mc._url);
};
var image_mcl:MovieClipLoader = new MovieClipLoader();
image_mcl.addListener(mclListener);
image_mcl.loadClip("http://www.macromedia.com/images/shared/product_boxes/112x112/box_studio_112x112.jpg", image_mc);

The following example assigns the ContextMenu object menu_cm to the movie clip image_mc. The ContextMenu object contains a custom menu item labeled "View Image in Browser..." that has an associated function named viewImage().

var menu_cm:ContextMenu = new ContextMenu();
menu_cm.customItems.push(new ContextMenuItem("View Image in Browser...", viewImage));
this.createEmptyMovieClip("image_mc", this.getNextHighestDepth());
var mclListener:Object = new Object();
mclListener.onLoadInit = function(target_mc:MovieClip) {
   target_mc.menu = menu_cm;
};
var image_mcl:MovieClipLoader = new MovieClipLoader();
image_mcl.addListener(mclListener);
image_mcl.loadClip("photo1.jpg", image_mc);

function viewImage(target_mc:MovieClip, obj:Object) {
   getURL(target_mc._url, "_blank");
}

When you right-click or Control-click the image at runtime, select View Image in Browser from the context menu to open the image in a browser window.


Comments


No screen name said on Apr 3, 2005 at 6:02 AM :
When using non-latin characters in folder names and file names (i.e. cyrillic characters), you will get something like that in _url property, when unsing ActiveX control:
file://F:\Documents and Settings\Administrator\Desktop\���ntitled-1.swf
But, in standalone player the value works fine.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/mx2004/main_7_2/00001564.html