×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    22

    Read Dymanic Swf from Container - Problem

    Hi

    I am New to Flash Lite 2.0 I need a help..

    I have a 5 Swf in that Container would say the container as Xml have 5 Swf file and I have Master Swf File. From That Master File I have to read or load that Swf file one another one from Xml Container and show the Output. But Today We have 5 Swf File in tat Container tomorrow It would be 20 Swf..

    How I read Swf Files one another one in Master Swf, But these are all done Automatically. We wont give any input in Master File. Only We have to give Xml Container as input.

    Could you any one know the code .

    Awaiting for yr reply.

    Thanks.

  2. #2
    Nokia Developer Champion
    Join Date
    Jul 2008
    Location
    Pakistan
    Posts
    1,065

    Smile Re: Read Dymanic Swf from Container - Problem

    Lets talk something very simple to understand. Suppose, we have a txt file and a master swf file. Now, we want to load a number of child swf files in the master swf by looking in the txt file. But remember Flash Lite doesnt provide browsing paths facility (ofcourse! Platform Services provide a Media Management API to browse media files but we are talking about SWF) ,therefore, it is ur headache to fill the txt file with the required paths of the child swf files (may be by filling it manually, or writing to this txt/xml file via some third party tool like KuneriLite etc). Now, come to the point , lets say our txt file has the paths of child swf and it looks like this :
    Code:
    mymovie0=File:///e:/others/firstmovie.swf&
    mymovie1=File:///e:/others/secondmovie.swf&
    mymovie2=File:///e:/others/thirdmovie.swf&
    Now, by writing this AS 2 in Flash Lite , we can make it somewhat dynamic :
    Code:
    myData = new LoadVars();
    myData.onLoad = function() {
    i = 0
    while (true)
    {
    if (myData["mymovie" + i] == undefined)
    break;
    loadMovie(myData["mymovie" + i], _root); 
    i++;
    }
    };
    myData.load("myChild.txt");
    Now, our Flash lite app is soft coded and it automatically load the next movie clip if we just append a new movieclip path to our txt file i.e if we append
    Code:
    mymovie3=File:///e:/others/fourthmovie.swf&
    Hope i understand u correctly. Please, let me know if u have further questions on this issue.

    Best Regards,
    SajiSoft

  3. #3
    Registered User
    Join Date
    Nov 2008
    Posts
    22

    Re: Read Dymanic Swf from Container - Problem

    Hi saji..

    Thanks for yr reply..

    I have a quick doupts. Whether if my Master SWF file and my Child SWF in Micro SD card in local device(My Nokia Phone), Will it possible to read Child Swf File in Master Swf. Whether Flash Lite know the Path?

    I have to Read Child SWF file from Master Swf file in Micro SD File.

    Plz Reply to this.

    Thanks.

  4. #4
    Nokia Developer Champion
    Join Date
    Jul 2008
    Location
    Pakistan
    Posts
    1,065

    Smile Re: Read Dymanic Swf from Container - Problem

    Quote Originally Posted by vijai54 View Post
    I have a quick doupts. Whether if my Master SWF file and my Child SWF in Micro SD card in local device(My Nokia Phone), Will it possible to read Child Swf File in Master Swf. Whether Flash Lite know the Path?I have to Read Child SWF file from Master Swf file in Micro SD File..
    You can load local files (i.e file stored in ur phone's mmc or phone memory ) in Flash Lite using loadMovie api.But Flash Lite content CANNOT detect the path of other swf file by itself.You have to provide a path by urself.

    Best Regards,
    SajiSoft

  5. #5
    Registered User
    Join Date
    Nov 2008
    Posts
    22

    Re: Read Dymanic Swf from Container - Problem

    Hi saji..

    I try to load Child Swf File to Master SWF File By looking in Text File. But I am unable to load File.

    I tried what you mentioned above. But that was not worknig properly.

    I put Two SWF File Path In Txt Files.. And I tried to Load that in Master File.. Its not Working..

    Need your Help Saji

  6. #6
    Regular Contributor
    Join Date
    Feb 2005
    Location
    Karachi, Pakistan
    Posts
    277

    Re: Read Dymanic Swf from Container - Problem

    Try using relative paths, not absolute paths.

    for example:
    var mv1 = "movie1.swf";

    rather than,
    var mv1 = "file://e:/data/movie1.swf";

    Assuming your main SWF is in same folder as the child SWF.

    Hope it helps,

    // chall3ng3r //
    Faisal Iqbal (skype: chall3ng3r)
    Flash Mobile Specialist | Orison Technologies
    _____________________________________
    blog: F·L·A·S·H·I·S·M
    swf2go: www.swf2go.com

  7. #7
    Registered User
    Join Date
    Nov 2008
    Posts
    22

    Re: Read Dymanic Swf from Container - Problem

    Hi

    Thanks I can loaded Swf file from one to another.. But I got a result of first SWF File Only.. How to Load Multiple SWF File.. I used while loop to load.. But its not worknig


    How to stop First SWF File n start 2nd SWF File Automatically..


    Thanks once again

    AWAITING FOR YR KIND REPLY

  8. #8
    Regular Contributor
    Join Date
    Feb 2005
    Location
    Karachi, Pakistan
    Posts
    277

    Re: Read Dymanic Swf from Container - Problem

    If you want to load multiple files, one after another, the best option is to load one, wait until its loaded, then load next.

    Here's a quick sample:

    Code:
    var mcLoader:MovieClipLoader = new MovieClipLoader();
    var loadListener:Object = new Object();
    moviesArray = new Array("mv1.swf", "mv2.swf", "mv3.swf");
    loadCounter = 0;
    
    loadListener.onLoadInit = function(target_mc:MovieClip):Void 
    {
        trace(">> loadListener.onLoadInit()");
        trace(">> =============================");
        if(loadCounter < moviesArray.length)
        {
            loadNextSWF();
        }
        else
        {
            trace(">> All SWFs loaded!");
        }
    }
    
    function loadNextSWF()
    {
        var container = this.createEmptyMovieClip("container" + loadCounter, this.getNextHighestDepth());
        mcLoader.loadClip(moviesArray[loadCounter], container);
        loadCounter++;
    }
    
    mcLoader.addListener(loadListener);
    
    // start loading
    loadNextSWF();
    Please note I have not checked this code, just wrote directly in here. I hope it works

    // chall3ng3r //
    Faisal Iqbal (skype: chall3ng3r)
    Flash Mobile Specialist | Orison Technologies
    _____________________________________
    blog: F·L·A·S·H·I·S·M
    swf2go: www.swf2go.com

  9. #9
    Registered User
    Join Date
    Nov 2008
    Posts
    22

    Re: Read Dymanic Swf from Container - Problem

    Hi

    Thanks for yr code.. Now I can loaded all the swf files at a time.. how to load one by one.. i put sleep method to start 2nd swf file, but its not working. could you say that how to run one another one.

    thanks for once again

  10. #10
    Regular Contributor
    Join Date
    Feb 2005
    Location
    Karachi, Pakistan
    Posts
    277

    Re: Read Dymanic Swf from Container - Problem

    Hi,

    Sorry I didn't get it. What you mean by "i put sleep method to start 2nd swf file, but its not working"?

    The sample code I gave in previous reply, shows you how to load multiple files one after another.

    Can you share your code so i can get better idea where you're making mistake.

    Best,

    // chall3ng3r //
    Faisal Iqbal (skype: chall3ng3r)
    Flash Mobile Specialist | Orison Technologies
    _____________________________________
    blog: F·L·A·S·H·I·S·M
    swf2go: www.swf2go.com

  11. #11
    Registered User
    Join Date
    Nov 2008
    Posts
    22

    Re: Read Dymanic Swf from Container - Problem

    Hi


    I put the Same Code which u gave me to load the Multiple swf file in a main File.. But that code loaded all the Swf Files at a time.

    But I need to load first Swf file and after it completely load and execution, i need to load 2nd Swf File, after his exection over then only 3rd swf file will load..

    I am not get this loading properly. so i tried to put some break , sleep to execute properly. its not working correctly.

    So could you say how to load one by one.


    Plz help me..

    Thanks

  12. #12
    Registered User
    Join Date
    Nov 2008
    Posts
    22

    Re: Read Dymanic Swf from Container - Problem

    Hi

    This is the Code I Put

    var mcLoader:MovieClipLoader = new MovieClipLoader();
    var loadListener:Object = new Object();
    moviesArray = new Array("strongman.swf", "eyesClosed.swf", "stingray.swf");
    loadCounter = 0;

    loadListener.onLoadInit = function(target_mc:MovieClip):Void
    {
    if(loadCounter < moviesArray.length)
    {
    trace(loadCounter + "SWF File");
    unloadMovie(target_mc);
    loadNextSWF();
    }
    else
    {
    trace("All SWFs loaded!");

    }
    }

    function loadNextSWF()
    {
    var container = this.createEmptyMovieClip("container" + loadCounter, this.getNextHighestDepth());
    trace("Container "+ container);
    mcLoader.loadClip(moviesArray[loadCounter], container);
    loadCounter++;
    //container.clear();

    }

    mcLoader.addListener(loadListener);

    // start loading
    loadNextSWF();



    If try to load one another one, for that i include this unloadMovie(target_mc) with your code. But it load only 3rd SWF File.. If i not put this unloadMovie(target_mc), then it run all the swf file at a time.

    Plz plz help me.

  13. #13
    Regular Contributor
    Join Date
    Feb 2005
    Location
    Karachi, Pakistan
    Posts
    277

    Re: Read Dymanic Swf from Container - Problem

    Ahh, now I get it.

    You want one SWFs to play, then when it's animation is complete, load next... right?

    Code:
    var container = this.createEmptyMovieClip("container", this.getNextHighestDepth());
    var mcLoader:MovieClipLoader = new MovieClipLoader();
    var loadListener:Object = new Object();
    moviesArray = new Array("mv1.swf", "mv2.swf", "mv3.swf");
    loadCounter = 0;
    
    loadListener.onLoadInit = function(target_mc:MovieClip):Void 
    {
        trace(">> loadListener.onLoadInit()");
        trace(">> =============================");
        trace(">> SWF loaded: " + target_mc._url);
    }
    
    function loadNextSWF()
    {
        mcLoader.loadClip(moviesArray[loadCounter], container);
        loadCounter++;
    }
    
    mcLoader.addListener(loadListener);
    
    // start loading
    loadNextSWF();
    Now, this code will only load one SWF from the array. In all your child SWFs, when animation is complete, you call the loadNextSWF function of the _parent.

    Code:
    // in child SWF, last frame
    _parent.loadNextSWF();
    This, way only one SWF is loaded at a time. When it completes animation, next is loaded in same container MC. No need to unload.

    Hope now it's the way you want it

    // chall3ng3r //
    Faisal Iqbal (skype: chall3ng3r)
    Flash Mobile Specialist | Orison Technologies
    _____________________________________
    blog: F·L·A·S·H·I·S·M
    swf2go: www.swf2go.com

  14. #14
    Registered User
    Join Date
    Nov 2008
    Posts
    22

    Re: Read Dymanic Swf from Container - Problem

    Hi

    Thanks a lot.. It working fine.

    Now I tried this code too

    myData = new LoadVars();
    myData.onLoad = function() {
    i = 0
    while (true)
    {
    if (myData["mymovie" + i] == undefined)
    break;
    loadMovie(myData["mymovie" + i], _root);
    i++;
    }
    };
    myData.load("myChild.txt");


    In that "myChild" text file, we have like this

    mymovie0=File:///e:/demon.swf&
    mymovie1=File:///e:/eyeclosed.swf


    But I tried this to execute swf files one by one, i got only the first swf file. i wont get other swf files.

    could you tell me the solution..

  15. #15
    Registered User
    Join Date
    Nov 2008
    Posts
    22

    Re: Read Dymanic Swf from Container - Problem

    Hi..

    Is there any other solutions to load the multiple swf files in main file without doing any other changes like _parent.loadNextSWF();

    Because I have only sample swf files only.I am not have corresponding FLA Files.

    Could you tell me plz

Similar Threads

  1. 编译Qt样例出错,请看如下
    By TD3 in forum [Archived] Qt General ( Qt技术)
    Replies: 14
    Last Post: 2009-12-24, 03:23
  2. Container with scroll problem??
    By sunil304047 in forum Symbian
    Replies: 5
    Last Post: 2009-06-23, 13:07
  3. Problem with Skin enabling - disabling and Setting List in S60
    By sauvikds in forum Symbian User Interface
    Replies: 1
    Last Post: 2008-08-22, 13:45
  4. File read problem
    By kannabiran.krish in forum Symbian
    Replies: 1
    Last Post: 2007-09-14, 14:38
  5. Replies: 2
    Last Post: 2007-08-04, 13:17

Posting Permissions

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