2
votes

I want to add a picture to my SWF file as a loadeMovie() to a symbol or to my whole page. I can do that and I know a lot of ways but in all of them you have to put that image file beside your SWF in the same folder.

As I work with c# and I have to communicate with SWF is there any way to send a directory path of your picture to SWF to show that image?

That image can be JPEG or BMP or anything. There is no difference for me to work with AS2 or AS3.

var mcHolder:MovieClip = createEmptyMovieClip("mcHolder", getNextHighestDepth());
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);

mcLoader.loadClip("z.jpg", mcHolder);

and other simple code that worked:

loadMovie("z.jpg","dd");
1
Welcome to SO! Please consider presenting some code to make the issue more clear. - BartoszKP
i just want to know is it possible to load an image in swf by giving a directory of a file on my pc as string ? if yes. how? - user2921883
Don't repeat the same thing in the comment. Update the question to be more clear. As I've mentioned - it is good to provide a relevant code sample. - BartoszKP
alright.loadMovie("z.jpg","dd"); i tried this but it certainly image file needs to be beside swf - user2921883
and i tried this: var mcHolder:MovieClip = createEmptyMovieClip("mcHolder", getNextHighestDepth()); var mcLoader:MovieClipLoader = new MovieClipLoader(); mcLoader.addListener(this); mcHolder.height=5; mcHolder.width=5; mcLoader.loadClip("z.jpg", mcHolder); - user2921883

1 Answers

0
votes

You should be able to provide a directory structure from the example you provided. Here is a quick sample:

<embed src="myFlashMovie.swf"
    quality="high"
    bgcolor="#ffffff"
    width="550"
    height="400"
    name="myFlashMovie"     
    FlashVars="directory=directory"
    align="middle"
    allowScriptAccess="sameDomain"
    allowFullScreen="false"
    type="application/x-shockwave-flash"
    pluginspage="http://www.adobe.com/go/getflash"
/>

Now you should be able to get the 'directory' string and use it on your code:

var customDirectory:String = LoaderInfo(this.root.loaderInfo).parameters.directory;

and finally the reveal:

mcLoader.loadClip(customDirectory+"/z.jpg", mcHolder);