A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Load Movie question...

Hybrid View

  1. #1
    Junior Member
    Join Date
    Sep 2000
    Posts
    10
    As with many Flash Author's that have started using Wildform SWFx this is the first time I've encountered or needed to use the 'Load Movie' Action.

    Ok I created an effect and saved it as ABCTest.swf.

    I then added the 'Load Movie' Action on Frame 1. Upon testing the movie with 'Test Movie' I received the following error-:

    Error opening URL "C:\Program Files\Macromedia\Flash 4\ABCTest.swf": only local files supported in Test Movie

    How can I test this movie without having to specify a URL?

    Once I Previewed the movie using the 'HTML' preview setting I could then see the effect. Also in the 'Load Movie' action cna I specify a Target name there?

    Kind regards and great program (After I work this Load Movie' Action out

  2. #2
    Junior Member
    Join Date
    Sep 2000
    Posts
    10
    Hmmm. Further testing reveals something interesting. In the 'Load Action' URL Field I simply put ABCTest.swf movie in with no path or URL. The error indicated in my former post showed that it was looking for the ABCtest.swf in C:\Windows\Temp. For what reason I don't know but to check the theory I put the ABCTest.swf file C:\Windows\Temp and voila I could test the Load Movie Action locally.

    But why does Flash look for the file there? Is it possible to alter the default folder where Flash expects this file to be?

    Ok I'm happy I performed the Load Movie Action correctly but now what if I wanted to either A) Move that Loaded Movie effect around the stage in a Motion Tween OR B) Alter it's Alpha to Fade from 100 to 0? Of course the answer is to modify an instance of the Loaded Movie but hang on - I don't have a movie-Clip/Symbol in my Library. How do I control the Loaded Movie once it's performed the effect? Where is the Loaded Movie within the Main Movie. If it's nt in the Library as a Symbol then how can you make it an Instance and hence Target it with a 'name'.

    I hope I'm making some semblence of sense here :/ Basically Once you've loaded the movie do you then alter it to either Fade Off or Move off the stage when there's no instance to do so?

  3. #3
    Senior Member
    Join Date
    Aug 2000
    Posts
    547
    Hey Blade:

    How's it going for you this fine Saturday afternoon?

    So, I'm not certain why the specific error you describe is ocurring -- unless you didn't save the movie with the LoadMovie command. If you didn't specifically save that movie, it will create the .swf in the temp directory because it wouldn't know where else to put it. See what I mean?

    Other than that, there are many specific quirks with Load Movie that I have encountered in my personal development. As I said, none are like what you describe. But, as fortune would have it, I already have some words written up on difficulties of using Load Movie. I include it here in the hope that it may provide you some assistance:

    (This is excerpted from the tutorial which accompanies the .FLA for the SWfX help system -- the first help system built entirely in Flash. The full tutorial is available: http://www.were-here.com/forum/tutor...elp/index.html.)


    begin
    ----------------
    You can use multiple Flash movies together at runtime with the "Load Movie" action. This action is more or less straightforward. I personally always load a movie into an empty movie, rather than a separate layer, because I find movies much easier to communicate with and control.

    However, there are many hidden (and undocumented) issues with using the Load Movie command. I will give a brief overview of these here.

    Let us start with the following example. You have the following files:

    C:\SWfXdemo\Parent.swf
    C:\SWfXdemo\child\Child.swf

    Now, let's say Parent.swf contains an empty movie entitled "load_child" and the action Load Movie ("child\child.swf", "_level0/load_child"). This should work fine - at runtime, Parent.swf should load Child.swf without a problem.

    Now, let's say that Child.swf, in turn, loads a new movie:

    C:\SWfXdemo\child\grandchild\Grandchild.swf

    So Child.swf contains an empty movie entitled "load_grandchild" and the action Load Movie ("grandchild\grandchild.swf", "_level0/load_grandchild"). This too, should run fine - at runtime, Child.swf should load Grandchild.swf.

    However, if, under these new circumstances, you run Parent.swf, which loads child.swf, you will not be able to load grandchild.swf for two important reasons.

    First, when you load a movie into a new movie, like we loaded child.swf into parent.swf, all references in child.swf to _level0, which had previously referred to the top level of Child.swf, now refer to the top level of Parent.swf. So, when you run Parent.swf, which loads Child.swf, Child.swf attempts to load Grandchild.swf into a movie called "load_grandchild" at _level0. Since _level0 now refers to the top level of Parent.swf, and there is no movie by that name on that level, the operation fails.

    The other issue preventing successful execution of this SWF is the directory structure. When you load child.swf into parent.swf, all Load Movie actions with relative links (using "child/child.swf" instead of "c:\SwfXdemo\child\child.swf") then take the base of the top level movie, in this instance Parent.swf. So, for example, when Child.swf, from within Parent.swf, attempts to load "grandchild\grandchild.swf", Flash attempts to search for the following file:

    C:\SwfXdemo\grandchild\grandchild.swf
    Instead of the intended:
    C:\SwfXdemo\child\grandchild\grandchild.swf

    Of course, it will fail since the file it is looking for does not exist. In the event that a file with the name that Flash was looking for did exist - then Flash would load the incorrect movie and not produce an output error, meaning that you might not even realize it. This could cause severe debugging headaches, so be careful.

    The final issue I will discuss regarding the use of Load Movie, is communication between movies. To communicate between these movies, you need to understand the structure that is created by the load movie command. What you have at the end of this example, when it works, is an .SWF with the following structure

    _level0/load_child/load_grandchild
    or,
    parent.swf/child.swf/grandchild.swf

    So for example, there is a dialog box in parent.swf (labeled "dialog"), you wish to turn on from a button on the top level of grandchild.swf. There are two ways to do this. The button would contain action script telling dialog to turn on.

    You can use an absolute reference to dialog:

    On (Press) Begin Tell Target ("_level0/dialog")
    Goto "On" and Stop
    End Tell Target End On

    Alternatively, your tell target could also contain a relative reference to dialog.

    Begin Tell Target ("../../dialog")

    It is up to your individual circumstances whether it is better to use absolute or relative linking. Each has advantages for different purposes, but you should always be aware of these issues when developing your structures.

    -------------------
    end

  4. #4
    Junior Member
    Join Date
    Sep 2000
    Posts
    10

    Thankyou Rblank...

    A very complete reply and I do thankyou for your time and effort. Well after posting my initial thoughts I did indeed find that you had to Save your Movie.fla before it recognized the location of my test Load Movie ABCtest.swf, because as you suggested if you haven't saved the Movie it will look for your Load Movie in C:\Windows\Temp. Whew one problem solved

    Now I got to thinking about how to Load Movie into a Target as the suggestion made in the Wildform FAQ is a little daunting (At first) so I thought there must be an easier solution. The Wildform Solution uses the Getproperty/TRace action to find the X/Y Locaiton of the Loaded Movie then you use Set Property to indicate where you want it to go.

    My initial confusion stemmed from the fact that yes I could load my movie as a 'Level' but I didn't know how to Load Movie into a 'Target'. Well I went to bed disgusted and thought hang on I'll read the Macromedia Load Movie link someone suggested. Well after reading that a big light went off (As often happens). For those that are still confused about how to load a movie into a Target Movie-Clip I'll post my solution.

    What I did was this-:

    1. Save your Test movie Test.Fla

    2. Create a New Symbol (Movie-Clip). Within your Movie-Clip draw a simple box with an outline of perhaps grey (If your movie background is Black as mine often are). Make the Box EXACTLY the same size as the Movie you wish to load (In my case ABCTest.swf). Make sure that the registration point of your Movie-Clip is on the Top-Left of the Box as the loaded movie defaults to the Top-Left of the Target Movie-Clip. Now that that's done go back to the main canvas.

    3. Drag your Movie.Clip symbol onto the stage and place it where you want your loaded movie to go. Modify the Instance and define it as anything - I called mine "Target". Now double-click the first frame where your Movie-Clip symbol resides and add your Load Movie Action. URL will be 'ABCtest.swf' and the 'Target' name will now be 'Target' (The name of the Movie-Clip Box you have on the main stage). This is where I got confused initially. If you simply performed a Load Movie Action on a frame the movie will load as 'Level' and you will then have no other control over it because it's not an instance, it's simply an SWF that will run independantly of eveything else. So getting back to it I used the anology of a Basketball and the Basket it's heading into. The Basketball is the movie you wish to Load and the Basket is your Target Movie-Clip.

    4. Now having added the Action you can then Test Movie and voila you can now see your ABCtest.swf effect exactly where you want it. Technically what this action is doing is actually replacing your Movie-Clip with the Loaded Movie so therefore your Instance is now in fact the Loaded Movie which is what you want. Now it's an easy matter to Move/Tween your effect around the stage because it is now an Instance. You can also now use the 'Tell Target' Command which makes Load Movie very powerful.

    I hope you followed my instructions as I don't normally write tutorials (I'm not in the same league as RBlank_Wildform that's for sure). If you have any other questions please post here and I'll explain further. I hope it helps someone at any rate.

    Thanks again RBlank_Wildform for your time.

  5. #5
    Senior Member
    Join Date
    Aug 2000
    Posts
    547
    Hey Blade,

    Glad this all worked out for you.

    You found out the most important thing about loading a movie into an empty movie: the center point of your empty movie is the upper left corner of the movie you are loading.

    I will get to rewording the Load Movie FAQ.

    Thanks,

    r

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center