Flash module add-on: Loading Another Flash Movie Within a Flash Movie (Relative Paths)

Flash module add-on: Loading Another Flash Movie Within a Flash Movie (Relative Paths)

by Edwin Lee -
Number of replies: 7
Hi all,
Within my main flash movie, i have code to load another flash movie:

this.createEmptyMovieClip("mcMovie", 1);
this.loadMovie("Movie.swf", "mcMovie");

However, when i added this movie as a Flash Activity Module, it couldn't seem to load the second movie.

i read somewhere that its got something to do with relative paths, and i have to add the "base" parameter, i.e.:

<object classid="..." codebase="..." width="800" height="600" id="Start" align="lt">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="Start.swf" />
<param name="menu" value="false" />
<param name="quality" value="high" />
<param name="bgcolor" value="#000" />
<param name="base" value="movies/Start/" />
<param name="FLASHVARS" value="POMovieSess=...&POGatewayURL=...&PODoneURL=..." />
<embed src="Start.swf" FLASHVARS="POMovieSess=...&POGatewayURL=...&PODoneURL=..." menu="false" quality="high" bgcolor="#000" width="800" height="600" name="Start" align="lt" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" base="movies/Start/" />
</object>


But given that the above is dynamically generated by view.php, how can i add in the "base" parameters?

i have tried adding it to the HTML (Start.html) that is published using Macromedia Flash (together with Start.swf) but the additional "base" parameters still don't get added to the HTML generated by view.php.



TIA and Regards,
Edwin
Average of ratings: -
In reply to Edwin Lee

Re: Flash module add-on: Loading Another Flash Movie Within a Flash Movie (Relative Paths)

by mike cockburn -
I too would love to know the answer to this one.

regards and TIA too!

Mike
In reply to mike cockburn

Re: Flash module add-on: Loading Another Flash Movie Within a Flash Movie (Relative Paths)

by Edwin Lee -
Hi mike,

i have managed to achieve this by making some changes to /mod/flash/view.php - a bit of workaround.

At line 396 of view.php, insert this line:
$baseUrl="movies/{$flash->moviename}";

This meant that the HTML generated by view.php is now:

<object classid="clsid:..." codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="800" height="600" id="..." align="lt">
<param name="allowScriptAccess" value="sameDomain" />
<param name="BASE" value="movies/MyMovie" />
<param name="movie" value="movies/MyMovie/MyMovie.swf" />
<param name="menu" value="false" />
<param name="quality" value="high" />
<param name="bgcolor" value="#000" />
<param name="FLASHVARS" value="POMovieSess=...&POGatewayURL=..." />
<embed src="movies/MyMovie/MyMovie.swf" BASE="movies/MyMovie" FLASHVARS="POMovieSess=...&POGatewayURL=..." menu="false" quality="high" bgcolor="#000" width="800" height="600" name="My Movie" align="lt" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>

Take note that i'm using "No Preloader". Also, do make sure that it will not break your existing movie links when making this change.

In reply to Edwin Lee

Re: Flash module add-on: Loading Another Flash Movie Within a Flash Movie (Relative Paths)

by mike cockburn -
Hi Edwin,
thanks for your reply.
I will give it a go!

Regards

Mike
In reply to Edwin Lee

Re: Flash module add-on: Loading Another Flash Movie Within a Flash Movie (Relative Paths)

by Nicola Bennett -

 Hi Edwin,

I am also having this problem and have made the change to the view.php file (see below) but with no luck sad.

I'm using the Flash MX learning interactions preloader, not sure if this affects anything?

Plus where can you check the html that the view.php generates? I've shown below part of the html source code of the page where the flash activity is playing. Is this the html you refer to? If so, does it look correct?

Hope you can shed some light on this.

Thanks
Nicola.

view.php:

//construct movie name for laoder url if we are using one.
        //Creates a new movie with the same dimensions and framerate of the main movie if one hasn't been created already.
        $moviecachedir="flash_moviecache";
        $servicePath="$CFG->dirroot/mod/flash/movies/{$flash->moviename}/service.php";
        if (!$flashMovieSess=flash_get_flashMovieSess($flash->id, $course->id, $cm->id, 'service', $servicePath))
        {
            error("Couldn't set up flash session!");
           
        }
        $doneUrl=urlencode("$CFG->wwwroot/mod/flash/view.php?sess_token=".$flashMovieSess);
        $defaultGatewayUrl=urlencode("$CFG->wwwroot/mod/flash/server/MoodleGateway.php");
        if (!$flashmovierec=get_record('flash_movies', 'moviename', $flash->moviename))
        {
            error('Can\'t find movie record for movie '.$flash->moviename.' in \'flash_movie\'!');
        }
        if ($flash->usepreloader=="0")
            {$baseUrl="movies/{$flash->moviename}";
  
            $firstloadurl="movies/{$flash->moviename}/{$flash->moviename}.swf";//no preloader
        } else
        {
            //baseUrl is the address relative to which content is loaded from within flash when a relative url is used :
       
   $baseUrl="$CFG->wwwroot/mod/flash/resources/";
            $fonts=urlencode($flash->fonts);
            if ($flash->usepreloader=="2") // mx learning interaction tracking
            {  
                $movieloadername='mxli_loader';
            } elseif ($flash->usepreloader=="1") // font and movie preloader
            {
                $movieloadername='loader';
            }
            $movieloaderpath="$CFG->dataroot/$moviecachedir/$movieloadername/$movieloadername{$flashmovierec->width}x{$flashmovierec->height}x{$flashmovierec->framerate}.swf";
            if (!file_exists($movieloaderpath))
            {

 

html flash activity page:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="550" height="400" id="topic2" align="lt">
<param name="allowScriptAccess" value="sameDomain" />
<param name="BASE" value="http://learning.prometheanworld.com/mod/flash/resources/" />
<param name="movie" value="loader.php/mxli_loader/550/400/12?ver=150"
<param name="menu" value="false" />
<param name="quality" value="high" />
<param name="bgcolor" value="#FF820" />
<param name="FLASHVARS" value="POMovieSess=ed9a45443048dc7080fe1f4c6fa44986&POGatewayURL=http%3A%2F%2Flearning.prometheanworld.com%2Fmod%2Fflash%2Fserver%2FMoodleGateway.php&POMovieURL=http%3A%2F%2Flearning.prometheanworld.com%2Fmod%2Fflash%2Fmovies%2Ftopic2%2Ftopic2.swf&POFonts=arial&PODoneURL=http%3A%2F%2Flearning.prometheanworld.com%2Fmod%2Fflash%2Fview.php%3Fsess_token%3Ded9a45443048dc7080fe1f4c6fa44986" />
<embed src="loader.php/mxli_loader/550/400/12?ver=150"
BASE="http://learning.prometheanworld.com/mod/flash/resources/"
FLASHVARS="POMovieSess=ed9a45443048dc7080fe1f4c6fa44986&POGatewayURL=http%3A%2F%2Flearning.prometheanworld.com%2Fmod%2Fflash%2Fserver%2FMoodleGateway.php&POMovieURL=http%3A%2F%2Flearning.prometheanworld.com%2Fmod%2Fflash%2Fmovies%2Ftopic2%2Ftopic2.swf&POFonts=arial&PODoneURL=http%3A%2F%2Flearning.prometheanworld.com%2Fmod%2Fflash%2Fview.php%3Fsess_token%3Ded9a45443048dc7080fe1f4c6fa44986"
 menu="false" quality="high" bgcolor="#FF820" width="550" height="400" name="topic2" align="lt" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object></a>

In reply to Nicola Bennett

Re: Flash module add-on: Loading Another Flash Movie Within a Flash Movie (Relative Paths)

by Jamie Pratt -
Hi Nicola,

The change to the code you've made will only affect movies not using the preloader. You could put the resources you want to load in http://learning.prometheanworld.com/mod/flash/resources/ For movies that use a preloader this is where external files are loaded from when using relative paths. You can also use an absolute path to load your external resources eg. http://learning.prometheanworld.com/mod/flash/movies/{yourmoviename}/fileyouwanttoload.txt

Jamie
In reply to Jamie Pratt

Re: Flash module add-on: Loading Another Flash Movie Within a Flash Movie (Relative Paths)

by Nicola Bennett -

Thanks Jamie.

I've moved the linked flash files to the resources folder and all works fine.

Think I've now fixed all the issues with the Flash activity, it's looking good! big grin

Thanks again everyone for your help.

Nicola.

 

In reply to Nicola Bennett

Re: Flash module add-on: Loading Another Flash Movie Within a Flash Movie (Relative Paths)

by kaoshel hello -

Hi there I just read the title of your question and I too would like to know how to use flash within flash.

I have a flash website the whole site is embedded in HTML but the site was made in Dream weaver. I want to embed another flash site within the first 1

I think I have to embed a HTML document within the first flash site and then embed the second flash site within that HTML page

So it would look like this

HTML - Index Page

Flash - embedded within the Home (index page)

HTML - embedded with the Flash above

Flash - embedded within the HMTL file that was embedded within the first Flash file.

 

I know this sounds really confusing but I have out of answers for this and I have come to a road block in developing my website. I really hope that some1 out there has an answer. thank you for in advance.