Loadmovie in AS#

Dear my friends
I have one .as file named Hanif.as with the following codes :
package {
import flash.net.URLRequest;
import flash.display.*;
import flash.events.*;
public class Hanif {
function Hanif():void {
var i:Loader =new Loader();
//var mc:MovieClip=new MovieClip();
i.load(new URLRequest("F2.swf"));
addChild(i);
trace("Hi");
and I have one .fla file next to this .as file with the
following code in frame one :
var Hanifobj:Hanif=new Hanif();
but when I run the .fla file it has the following error :
1180: Call to a possibly undefined method addChild.
Please help me.
Thanks.

It did not work or you get the same error?
Also, I think you need to declare constructor public. Return
type cannot be used in the constructor because constructor returns
an instance of the class.

Similar Messages

  • Losing variables using loadMovie in input Text Field

    Hello! Im trying to load an swf into another swf that has a variable in the text input field. Im a designer and not a programmer but I am using this tutorial to get started in loading a form with a variables in it.
    http://www.kirupa.com/developer/actionscript/flash_php_email.htm
    What im doing is trying to duplicate is the text box so that when i want to load new_box.swf (with a variable name "company") into main.swf into a movieclip with an instant name "loader." using this:
    on (release) {
        loadMovie ("new_box.swf", "_root.form.loader");
    I can get the movie to load but it loses the variable "company" in the process and when i send the form it doesnt work. If i just keep it in the main timeline it works but not when i loadMovie. Any info would help. Thank you.

    when you load an swf into another, the _root will refer to the root of main swf.
    try add this code to first frame of your loaded swf.
    this._lockroot = true;

  • LoadMovie without having to use full path/URL

    I've always used loadMovie to call external swf files from a
    main/menu swf file, but it seems that some new security settings
    and restrictions, I'm not able to do this anymore - at least not
    online. All my swf files are in the same directory, and when I play
    the swf locally, it loads all the external swfs without a problem.
    I tried changing the path to my swf in the loadMovie command
    to the pull path on the server, and this worked. The problem is, I
    have to hand off my website to another company, and it will go
    through many rounds of testing (and servers) before eventually
    going online. Is there any way to avoid having to use the full
    path/domain in the loadMovie command for a situation like this
    where the domain/path will change?
    I have this in the Flash embed tag:
    <PARAM NAME="allowScriptAccess" VALUE="sameDomain" />
    I have this as my loadMovie command:
    loadMovie ("flashfile.swf", 1);
    But it only works when I have it like this, which is a
    problem because the URL will change many times before launch.
    loadMovie ("
    http://www.website/media/flashfile.swf",
    1);
    Any help would be appreciated!

    Yes, I've done this all the time too, and never had this
    problem, which is why I'm stumped.
    I've changed my code to this, with module_proxy being an
    empty movie clip. This works. But when I take out the URL and path,
    even though the swf files are in the same directory, it's doesn't
    play.
    loadMovie ("
    http://www.website/media/01_Mixie_Pixie_Telegram_Service.swf",
    "module_proxy");
    _parent.gotoAndPlay("dim_menu");
    //openCountdownFile();
    stop();
    Then, I tried to create a varible for the URL/domain, so I
    can change it out more easily (although when I hand this off, I
    won't be able to do that):
    var domainPath = "
    http://www.website/media/"
    function (openCountdownFile){
    var linkToSWF = domainPath + eval(PgFile[item_chosen]);
    loadMovie (linkToSWF, "module_proxy");
    parent.gotoAndPlay("dim_menu");
    var swfPageLabel = item_chosen.toString();
    gotoAndPlay(swfPageLabel);
    This doesn't seem to work either. So, if swf files SHOULD be
    able to communicate using loadMovie, why am I having this problem?
    Thanks.

  • Dynamically create empty mcs and asign elements from array and loadmovie

    I'm creating an educational game for my school students.
    A little boy is flying through the city when he encounters objects flying from left to right.
    He hears a SOUND eg: Dog - he must go and click the dog image with the flying cursor. There are at least 5 DIFFERENT objects that should be flying on the screen. There could be various of them at any one time.
    I have the roots of the images in an xml file. And the actual swf are in a file called IMAGE and the sounds in SOUND.
    My problem is that most tutorials I see use the attachmovie method but I don't want to put all the swf's in the library as there are hundreds.
    I have to use the loadmovie method.
    I take it I have to loop through the array and assign each element to an empty movieclip which in turn is in the loop so you get 5 empty clips - I will use i (index). It doesn't seem to be working. I shall keep trying and post back here if I get any luck but I'm running out of ideas.
    Then the objects have to float across the screen. Don't know whether to use tween object or onEnterFrame handler or other. AND someone has mentioned using setinterval to "spit out" the objects.
    BUT if I have five flying across the screen I'm left without clips to stick in any more.
    Oh my head hurts but I will keep going.
    CHEERS if any help is around. This should be quite a standard thng for game developpers. Code at the moment
    function loadEnemies():Void {
    enemy_xml = new XML();
    enemy_xml.ignoreWhite = true;
    enemy_xml.onLoad = function(success:Boolean) {
    if (success) {
    _root.parseEnemyXML();
    //enemy_xml.load("level_"+level+".xml");
    enemy_xml.load("data/animal_catch.xml");
    function parseEnemyXML():Void {
    rows = enemy_xml.firstChild.childNodes.length;
    for (var i:Number = 0; i<rows; i++) {
    var row_string:String = String(enemy_xml.firstChild.childNodes[i].firstChild.firstChild);
    _root["row_"+i+"_array"] = row_string; //MAIN ARRAY holds an array images/dog_a.swf/ images/cat_a.swf etc... all five
    _root.createEmptyMovieClip("enemyObjects", 1);
    enemyObjects.createEmptyMovieClip("holder_"+i, i);
    _root["object"+i] = new Sound(enemyObjects["holder_"+i]);
    trace(row_string);
    loadMovie["row_"+i+"_array"], ["holder_"+i]
    if (level == 1) {
    alerts_mc.play();
    } else {
    currRow = 0;
    rowCounter = 0;
    OK got to about here BUT
    a. I started to get confused around the createEmptyMovieClip part
    b. I KNOW I shouldn't have Sound(enemyObjetcs etc... BUT I copied the code from a tutorial and I don't know what to replace it with.
    I'm close but I need a little polishing.

    It doesn't do you much good to work with borrowed code that you do not understand.  Your best bet will be to start small, creating one functional piece of the puzzle at a time, and work your way up.  Start with making sure you are loading and parsing the xml properly, then set about loading the external content, then see about making that content move around, etc...
    In the code you show, your loadMovie line of code does not resemble anything I have seen before, looking more like (but not quite like) a multi-dimensional array element than a loadMovie() function call.  If you find you need to have control of the items as soon as they load, then you should consider using MovieClipLoader.loadClip instead of loadMovie.  The MovieClipLoader class provides features, such as to be able to determine when items have fully loaded.

  • Passing in movie to load via loadmovie from page

    Hi all,
    My page loads a default swf using SWFObject, which in turn
    loads other swfs containing page content. Using SWFObject, I have
    non Flash content for the default page that loads if the flash
    player is not present.
    I would like to have each flash page replicated as an HTML
    page, passing the flash page to load into the default Flash page.
    For example, if the user visits mysite.com/aboutus.cfm, the
    page should pass in aboutus.swf as the page for default.swf to
    load, or if the user visits mysite.com/services.cfm, then
    services.swf should be passed in to the default.swf movie.
    I have tried the method shown on
    http://blog.deconcept.com/swfobject/,
    using:
    <script type="text/javascript">
    var so = new SWFObject("default.swf",
    "flash", "760", "800", "9", "#FFFFFF");
    so.addParam("wmode", "transparent");
    so.addParam("allowscriptaccess", "samedomain");
    so.addVariable("movieToLoad", "homepage_v1.swf");
    so.write("flash");
    </script>
    but this fails to load the movie "homepage_v1.swf" using the
    following in my default Flash page:
    // LOAD DEFAULT PAGE
    loadMovie(_root.movieToLoad, 10);
    Any advice on where I am going wrong?
    TIA,
    Paul

    Thank you clbeech,
    I think you may have misunderstood me (if I have not
    misunderstood you).
    My reasoning for doing what I am is that each flash page will
    have its own search engine friendly html page, for example
    aboutus.html. All pages will contain an html version of the site
    complete with links, which will be replaced by the swfobject for
    browsers with Flash capabilities.
    So once google (without Flash player) has indexed all my html
    pages, if a user clicks on the google result for about us, the
    aboutus.html page will load, which will then load the default Flash
    movie, passing in a variable telling it to load aboutus.swf as the
    default page. If the user clicks the result for services.html, that
    html page will load, which will again load the same default flash
    page, passing in the variable telling it to load services.swf.
    It all works when hardcoding the swf to load into the first
    frame as outlined in my snippet above, but does not seem to like
    the variable name.
    Any other ideas anyone?
    Thanks,
    Paul

  • Using loadMovie to load SWF linked to FLV

    I am having problems getting a movie (SWF) with an linked FLV
    file to play when I use loadMovie to load it in.
    I have an .FLV file named vid_9.flv. I have embedded it into
    a Flash movie named vid_9.swf using Flash 8 Professional. I am
    using "Progressive Download from a Web Server" and no controls.
    When I play the SWF on the stand-alone player (the FLV is in the
    same folder) it works great. Now when I call that SWF into another
    movie using
    swfHolder.loadMovie("SWFs/vid_9.swf");
    it shows it being completely loaded, but then never plays,
    all I get is a white screen. This is my second project in a row
    where this did not work. Any ideas as to why? Thanks for any
    help.

    onLoadComplete executes before the loaded swf's assets are initialized:  use onLoadInit.
    those function definitions in your loaded swf should NOT be in an onLoad method.  if they are defined on the main timeline of the loaded swf, use:
    var url:String = "scene05.swf";
            var movieClip:MovieClip = createEmptyMovieClip("movieClip", 0);
            var listenerObj:Object = new Object();
            listenerObj.onLoadInit = function (target_mc:MovieClip):Void {
                //It should execute these functions that are located in the onLoad event in the loaded swf.
                target_mc.initBackground();
                target_mc.initBackgroundWeg();
                target_mc.initVehicles();
                target_mc.initForeground();
                target_mc.initKnoppen();
            var movieClipLoader:MovieClipLoader = new MovieClipLoader();
            movieClipLoader.addListener(listenerObj);
            movieClipLoader.loadClip(url, movieClip);

  • Help with loadmovie in Flash 8

    hi flashCoders,
    this code used to work fine in old versions but now doesn't
    work
    theres is the code:
    <---
    _root.createEmptyMovieClip("fundo", 1);
    fundo.loadMovie("image3.jpg");
    fotosArray = ["image1.jpg", "image3.jpg", "image7.jpg"];
    function fotosRotativas() {
    i == 2 ? i=0 : i++;
    loadMovie(fotosArray
    , "fundo", "GET");
    setInterval(fotosRotativas, 5000);
    --->
    it starts loading first image, but the following images do
    not load. all
    files are in images folder.

    Thanx Albee!
    albee wrote:
    > you need to define i explicitly:
    >
    >
    >
    > _root.createEmptyMovieClip("fundo",1);
    > fundo.loadMovie("image3.jpg");
    > var fotosArray:Array = ["image1.jpg", "image3.jpg",
    "image7.jpg"];
    > var i:Number = 0;
    > function fotosRotativas() {
    > i == 2 ? i = 0 : i++;
    > loadMovie(fotosArray
    , fundo);
    > }
    > setInterval(fotosRotativas,5000);
    >

  • LoadMovie- loading an external swf into movieclip in AS3

    Im extremely frustrated.........im trying to do something
    that was once very simple, which has now become over complicated
    unecessecarily.....i want to do a simple loadMovie type action and
    load an external clip into a movieclip called ph. my AS2 code would
    be:
    loadMovie("ExternalMovieClip.swf","ph");
    or
    on(release) {
    loadMovie("ExternalMovieClip.swf","ph");
    This no longer works. Can somebody tell me the new code that
    i would use with AS3 to do exactly what i just demonstrated? I
    honestly dont even want to touch AS3. The only reason i want to use
    it is because it makes skinning the components SOOOOOO much easier
    than AS2. That is the one and only reason im trying to convert to
    AS3. All the new load movie AS3 examples ive seen on google look
    like half a page long to do what i used to do in 2 lines. There
    must be a simpler and much easier way. I am a designer. It looks to
    me like Adobe went back to making flash for programmers only again
    leaving us designers out of the mix. Someone please help me, im
    desperate. I also have other old code that im sure im going to have
    to convert to AS3 for it to still work, and i may eventually need
    help with that as well, but ill stick with this loadMovie problem
    for now. Any and all help is appreciated. Thanks

    have a look here:
    http://www.smithmediafusion.com/blog/?p=381
    use this:
    var i =new Loader();
    i.load(new URLRequest(”yourSwf.swf”));
    myMC.addChild(i)
    myMC is the name of your clip on the stage.
    Dan Smith > adobe community expert
    Flash Helps >
    http://www.smithmediafusion.com/blog/?cat=11
    http://www.dsmith.tv

  • Loading an external swf into a target, prompting it to go to a certain frame (loadMovie)

    hello,
    I am making a website for myself and am having an issue with loading an swf and commanding the swf to go to a certain frame. Bassically I have one page, that has 7 seperate small thumbnail images on it which are buttons, each is commanded to open an swf file labelled slideshow. The slideshow swf showcases the thumbnails seperatly in a much larger scale, then the user can look through the images using previous and next buttons.
    this is the code i have so far:
    on (release) {
              loadMovie("meglarge.swf",target_f);
    So each image or Button has this code on it. Then the movie "slideshow.swf" is loaded into the target destination "target_f"
    Although each time you click on any button it starts directly on the first frame of the slideshow. Which is always the first pictue. I want the user to be able to click on any image on the main page and it will load that frame of the slideshow first, which can then be navigated to the other pictures using forward and back buttons.
    I hope this makes sense, and i thank you in advance for the help

    In order to be able to control the loaded file you have to wait until it has fionished loading until you can command it to do anything.  Using loadMovie does not support any ability to determine when the file has finished loading.  You need to use the MoiveClipLoader class instead, where you can make use of the addListener method to detect when loading is complete.  If you look up the MovieClipLoader.addListener method in the help documents there is an example there showing how to use it.

  • Can your loadMovie "file name" = timeline frame number?

    I have a simple slideshow that has 70 slides. Each slide is on a frame in the main timeline and I have the following AS 2:
    loadMovie("Data/5.swf", "container");
    stop();
    There will be 70 SWF files in that Data folder. Instead of having to manually type in 1, 2, 3, 4, 5...in that "Data/5.swf" attribute, is there a way to just tell it to load the SWF number based on the current frame? Frame 1 in the timeline loads 1.swf, frame 2 loads 2.swf, etc.
    That way I can just put the same AS on each frame instead of having to manually go in and type each one.
    Thank you!
    Scot

    Hey, kglad. I remember you!
    I adjusted it for AS2:
              loadMovie("Data/"+this._currentframe+".swf", "container");
      stop();
    Thanks!!!
    Scot

  • Loadmovie not working

    Hello,
    I'm new to flash and am having alot of trouble getting the
    load movie action to work. Everything I've been reading suggests
    that what I'm doing should work. The main .swf and the
    slidingnav.swf that I want loaded on top are in the same folder on
    my local network. I have the load movie action on the 1st frame of
    my main.swf
    I've tried the following:
    loadMovie(slidingnav.swf,2);
    and...
    loadMovieNum(slidingnav.swf,2);
    Any problems with that code?
    I dont get any errors but when I test the movie or open
    main.swf, slidingnav.swf does not show up. I thought it could have
    something to do with the local plaback security in the publish
    settings but that didn't help. Its as if there is a file path
    problem but all the .flas and .swf files ar ein the same folder on
    the network.
    Please let me know if you have any ideas or need more info.
    thanks

    "trivue" <[email protected]> wrote in
    message news:e3fubd$54$[email protected]..
    >i got the load movie to work with an action but i cant
    seem to get it to work
    > with a button.
    > here is the code for the buttons:
    >
    > on (release) {
    > loadMovieNum("viz_content.swf", 2);
    > }
    > on (rollOver) {
    > gotoAndPlay("Image 1 (STOP)");
    > }
    >
    > Here is the test page:
    http://www.io.com/~gradya/main.htm
    > please let me know what i'm doing wrong...i'm sure its a
    dumb question
    > thanks
    It is loading those swfs.. (check your cache and you will
    see). The problem is that once you load something into level2, you
    cannot
    see the swf that loads into level1 below it later.
    Either load everything into the same level or hide the one
    that blocks the view of the one below. Another way is to use
    movieclips
    and swapDepths to put the one of interest at the highest
    depth.
    tralfaz

  • LoadMovie to load xml button file... undefined

    Hi, I am a designer and not familier with programming, my
    fiend purchased some flash buttons with xml file, when i run its
    swf its work perfect for me. there are 6 six buttons in it and i
    can easily change their name from xml file.
    ok here is the problem
    i want to assemble those button in another file and just
    those buttons to run from a different main file.
    i made a movie clip container and gave it an instance name
    holder_mc
    on main file on frame action i wrote this
    loadMovie("button.swf","holder_mc");
    ok there are loading in my file but problem is that now i see
    only one button now and written Undefined on the buttons.
    i am not sure why they are not working , i followed many
    online tutorials on loadMovie and did exactly same...
    one thing is interesting see here.. without xml files are
    loading perfect but with xml file i always get error even though
    xml file is already in my folder.
    I look forward to learn something from your experts.
    thank you very much
    i am using flash 8 professional. AS 2.0

    ok this time i made nav bar my main .. this time i am not
    loading nav bar in another movie since i was really undefined error
    but this time i have another xml file which is only a simple xml
    file but when i click on nav bar to load another swf file which is
    txt file, it loads but i don't see anything on it, no text , no
    content nothing there... even though when i view it separtly it
    works fine..
    any help would be appreciated.
    thanks

  • LoadMovie

    I am loading a swf, into a movie clip, using loadMovie.
    However I would like to be able to control the size of the swf
    being loaded into the movie clip.
    Is there a way to do this?
    I would like to make sure that whateevr the size of the swf,
    when it is loaded into the movieclip it will be no lareger than
    300pixelsx300pixels and if it is then it will be scaled down to
    fit.
    thanks to any responders.

    You can set the ._height and ._width or the _xscale and
    _yscale of the movieclip into which you are loading the swf.

  • Remove loaded movie after new loadMovie has been loaded

    i need to unload a movie once the new loadMovie is fully
    loaded because once i click on my button to do so, my current
    loaded movie goes away & the screen is white until the new
    loaded movie is loaded. (i hope that made sense)

    well I've done it a few ways successfully.
    The most recent, I dynamically create new movie clips.
    see ---
    http://www.13studios.com/erin
    --- Its a figurative painter's portoflio, so while its oil paint it
    is perhaps a bit [NSFW].
    Anyway, the panning effect kinda killed my normal process, so
    when you click a new button, it goes like this...
    PSEudoCODE
    //tickerVariable is defined on frame 1
    holder.create a new movie clip with name "something +
    tickerVariable"
    play preloader(tickerVariable);
    on completion of preloader {
    holder[something+(tickerVariable-1)].unloadMovie();
    //do anything else you need to do
    tickerVariable++
    I hope I didn't just make that more confusing.

  • A problem about loadMovie

    The problem pic's address:
    http://s2.album.sina.com.cn/pic/55aee59a02001291
    (please ctrl+c the URL )
    In the pic,the B.swf has a label,the label's position is
    random。
    Then,the A.swf has a MovieClip named Mc1,and Mc1
    loadMovie B.swf.
    We can see,the Label in the A.swf has a wrong
    position,it's not at the center of the Mc1.
    The question:If we do not know the Label's position in the
    B,how can I put it in the center of Mc1 in the A.swf?
    Thank you for the answer,and I am a new
    Flasher,my Flash is poor just like my English ^_^。
    Best wish.

    your broken english and incorrect terminology has made it
    difficult to understand.. but i think this is what you need.. to
    get something to load in the center you would set its _x and _y
    positions equal to the _width/2 and _height/2
    child_mc._x = parent_mc._width/2;
    child_mc._y = parent_mc._height/2;

  • Flash Update Breaks loadMovie command

    After a recent update of the Flash player, a number of older swfs have suddenly stopped working after many years. It has just happened in the last month. First in Chrome and now Firefox, IE, and Safari in both Windows and MacOS. The problem appears to be related to the loadMovie command. All of the affected SWFs were written in AS2 and our clients aren't willing to pay for recoding the files in AS3. Specifically, the loadMovie command is no longer loading JPEG files into a movie clip holder. An example of a script command that suddenly stopped working is this:
    photoFile = "images/front_"+_global.projName1+".jpg";
    photo.loadMovie(photoFile);
    The image file names and directory structures have not been altered. There have been no identifiable changes to the servers these scripts reside on.
    Is this a bug with the recent Flash Player updates? I hope the loadMovie command is not being deprecated. Any help would be appreciated.

    Hi
    I've noticed that too.
    One friend reported that his portfolio website doesn't work anymore. Its one main.swf file which loads gallery.swf file which holds photos.
    It was working fine for me, than I realised that my flash player is 11.5, after I upgraded it into latest 11.6 it stopped working.
    Website is full screen swf. When gallery (button click) load attempt is made, instead of loaded gallery, blank screen is shown.
    Right click shows: "Movie not loaded" message
    gallery.swf is loaded with this command: loadMovie("gallery.swf", "GalleryHolder");
    It's 3 years old AS2 project.
    It's not big deal for me because Ill re-make it with jquerry gallery, and flash is generally being hated anyway.
    Im not happy about bad hype against flash but we need to move on.
    But it could make big problems for other people because their projects will stop working.
    Regards

Maybe you are looking for

  • Smart Playlists are not syncing!

    I don't remember when this stopped working but I have 1 playlist that shows in iTunes but does not update on the iPod. Not sure why... all the others seem to sync just fine. Any insight would be greatly appreciated.

  • QM-SD: Sales Return Inspection lot status Error

    Hello Expert, I want to post Goods receipt in a Returns delivery with QM activated in the material but the following message is displayed: Status of inspection lot 060000000001 / partial lot 000000 does not allow good issue Message no. VL171 The insp

  • AppleScript - Open store link within App Store.app

    I want to open a link to the US Mac App Store within App Store.app https://itunes.apple.com/WebObjects/MZStore.woa/wa/switchToStoreFront?storeFront Id=143441 I tried a tell block with App Store.app to open location, to open URL, with https and itms s

  • Totalling Columns on a Tabular Form

    I have created a tabular form and would like to calculate a column total for 7 of the columns. The problem I have is that the columns I would like to total are all VARCHAR2. When I check the sum box in report attributes I get a totals line on the for

  • Help needed - using AG241 with WRT54GS

    Hey,recently i had successfully been using this set up.The wireless worked perfectly without any problems.However,setting it up to work was not so easy. And now my wireless routers setting were restored to default and I am unable to get the two worki