A Flash Developer Resource Site

Page 2 of 3 FirstFirst 123 LastLast
Results 21 to 40 of 57

Thread: loadmovie checking ...

  1. #21
    Junior Member
    Join Date
    Jul 2003
    Location
    Los Angeles
    Posts
    24
    OK, this will need some explanation but we'll get through it:

    put everything below this line in your code:



    // put the names of the Movie clips in this array in the order that you want them to be unloaded from the main movie
    moviesToUnload = new Array();
    moviesToUnload[0] = "home";
    moviesToUnload[1] = "mbaevents";
    moviesToUnload[2] = "exampleMC1";
    moviesToUnload[3] = "exampleMC2";
    moviesToUnload[4] = "exampleMC3";
    moviesToUnload[5] = "exampleMC4";
    // functions begin
    // this function will be in charge of the actual unload process.
    waitUntil = function (arg) {
    _root[arg].unloadMovie();
    this.onEnterFrame = function() {
    _root[arg].onUnload = function() {
    delete this.onEnterFrame;
    done = 1;
    trace("your movie has been unloaded");
    };
    };
    };
    // I re-wrote this function to cycle through the array at the top of this code and wait untill the previous movie is unloaded to continue.
    checkForSectionMc = function () {
    for (i=0; i<moviesToUnload.length; i++) {
    if (_root[moviesToUnload[i]]) {
    waitUntil(moviesToUnload[i]);
    this.createEmptyMovieClip("wait", 1);
    wait.onEnterFrame = function() {
    if (done) {
    delete wait.onEnterFrame;
    done = 0;
    }
    };
    }
    }
    };



    I hope this helps you out...
    lemme know if you need anything else

  2. #22
    Member
    Join Date
    Jul 2003
    Location
    Brampton, ONT
    Posts
    50

    Update

    Hey Donnie,

    Awesome script, I understand how it works now, very clever how you have the code check and wait till the previosMc unloads .. nice!

    I have added your code to my script .. works great!

    Now, I'm trying to create a text auto scroller animation (kinda like a text ticker) that reads from an external txt file ..

    Have any ideas?

    I'll update you as I continue with the site ..

  3. #23
    Junior Member
    Join Date
    Jul 2003
    Location
    Los Angeles
    Posts
    24
    Hey Jesseyn

    Thanks, I thought you might like that...

    I am glad to hear that everything is working well for you, code can be an interesting creature at times... I've fought with it many times, yet there is always a way to do something.

    As for the ticker:

    txt = "<font face = \"verdana\" size = \"10\" color = \"#000000\">I am a massive <a href = \"http://www.google.com\"><font color = \"#0000FF\"><u>amount</u></font></a> of text that you can replace with your own, as you can see this is a variable that you could potentially replace with the text from an outside document and format it to html 1.0<font>";
    this.createTextField("ticker",1,50,50,100,16);
    ticker.bold = true;
    ticker.border = true;
    ticker.selectable = false;
    ticker.html = true;
    ticker.htmlText = txt;
    this.createEmptyMovieClip("setTicker",2)
    setTicker.onEnterFrame = function(){
    ticker.hscroll += 1;
    }

    copy and pase this directly into your movie... it should give you what you want...



    Donnie


    www.pixelrot.com

  4. #24
    Member
    Join Date
    Jul 2003
    Location
    Brampton, ONT
    Posts
    50

    you ROCK!

    added it .. works awesome .. I just have to add some tune-ups here and there ..

    Hey .. if you think you are done .. you AINT! hahahaha .. but hey again, thanks, it now makes sense, I can disect the script the first time I look at it .. now, I wish I can write my own ..

    I'll have some more questions for you tomorrow .. I'll be up late working on some cleanup and tuneups and more questions for you.

    I'll post up some new qs later

  5. #25
    Member
    Join Date
    Jul 2003
    Location
    Brampton, ONT
    Posts
    50

    Quick Q

    The code you gave me reads from an internal txt information ..

    How can I use an external txt file to this script? So that I can just update the external file, and the looktexMC will read the txt file and load it in the ticker?

    Any ideas?

  6. #26
    Junior Member
    Join Date
    Jul 2003
    Location
    Los Angeles
    Posts
    24
    save a *.txt file as whatever you want in the same folder as the movie loading the *.txt file.

    your code will look like this:

    container = new LoadVars();
    container.load("whatever.txt");
    container.onLoad = function(){
    this.createTextField("ticker",1,50,50,100,16);
    ticker.bold = true;
    ticker.border = true;
    ticker.selectable = false;
    ticker.html = true;
    ticker.htmlText = container.txt;
    this.createEmptyMovieClip("setTicker",2)
    setTicker.onEnterFrame = function(){
    ticker.hscroll += 1;
    }
    }

    in your .*txt file put this:

    &txt="all the text just as it was before"&

    and that's it


    Donnie

  7. #27
    Member
    Join Date
    Jul 2003
    Location
    Brampton, ONT
    Posts
    50

    thanks!

    now, can I add RTF elements to my script to format my text? like make the bold, underline, color change?

  8. #28
    Junior Member
    Join Date
    Jul 2003
    Location
    Los Angeles
    Posts
    24
    no, use the <font face> that I wrote before, you can change the font and colour how you want too.

    If you want to add bold underline just use the html tags for them

    donnie

  9. #29
    Member
    Join Date
    Jul 2003
    Location
    Brampton, ONT
    Posts
    50

    shweeeet

    just as I thought .. now back to coding .. tis going to be a loong nite .. I've been here for almost 12hrs already ..

    this is great though, you've been of GREAT help .. I'll post other probs so don't go too far!

    Thanks D

    laterz

  10. #30
    Junior Member
    Join Date
    Jul 2003
    Location
    Los Angeles
    Posts
    24
    haha,

    no prob... Glad to help. I actually have been pretty adament about flash lately, I even bought a book on flash gaming to further my knowledge... I've already read about 6 chapters since yesterday... I think I need a better social life....hahaha

    Take care

    Donnie

  11. #31
    Member
    Join Date
    Jul 2003
    Location
    Brampton, ONT
    Posts
    50

    Quick Q

    Hi Donnie ..

    I still can't load my external txt file from the script you gave me ..

    I did use the code as is

    stop();
    container = new LoadVars();
    container.load("maintext.txt","");
    container.onLoad = function() {
    this.createTextField("ticker", 1, 50, 50, 100, 16);
    ticker.bold = true;
    ticker.border = true;
    ticker.selectable = false;
    ticker.html = true;
    ticker.htmlText = container.txt;
    this.createEmptyMovieClip("setTicker", 2);
    setTicker.onEnterFrame = function() {
    ticker.hscroll += 1;
    };
    };

    and created a txt file with my text in it ..

    &txt="all the blah blah yakiddi shmakiddi"&

    file name maintext.txt


    what I'm I doing wrong?

    help?!

  12. #32
    Junior Member
    Join Date
    Jul 2003
    Location
    Los Angeles
    Posts
    24
    This was my fault, I forgot to change the references from the create a text field and create and empty movie clip from this to root when I put them inside the function. They wern't being called correctly.

    here's the new code: I also added in a lil piece that will set the text back to the original position after it's fully scrolled through. Jumps a little bit but you get the picture.

    container = new LoadVars();
    container.load("maintext.txt", "GET");
    container.onLoad = function() {
    trace(container.txt);
    _root.createTextField("ticker", 1, 50, 50, 100, 16);
    ticker.bold = true;
    ticker.border = true;
    ticker.selectable = false;
    ticker.html = true;
    ticker.htmlText = "<font face=\"verdana\" color = \"#ff00000\" size = \"10\">"+container.txt+"</font>";
    _root.createEmptyMovieClip("setTicker", 2);
    setTicker.onEnterFrame = function() {
    if (ticker.hscroll == ticker.maxhscroll) {
    ticker.hscroll = 0;
    } else {
    ticker.hscroll += 1;
    }
    };
    };
    stop();

    in your text file it should be this:

    &txt=all the blah blah yakiddi shmakiddi&

    don't put any quotation marks...throws it off for some reason.

    Donnie

  13. #33
    Member
    Join Date
    Jul 2003
    Location
    Brampton, ONT
    Posts
    50

    awesome!

    thanks Donnie .. works great!

    now, this is our next feat .. things changed up on me ..

    Can I have the ticker read 2 lines tall, pause, scrollup then following lines follow, pause, scrollup.. .. .. etc etc ..

    whatchu think?

  14. #34
    Junior Member
    Join Date
    Jul 2003
    Location
    Los Angeles
    Posts
    24
    I'm not exactly sure what you mean...

    If you want to change the actual size of the ticker you can do that when you create the text field, it's set to 16 now.

    If you want to have the text on 2 lines you'll have to make sure that you tell the ticker that it's going to be multiline and no wrap, you can find the actual code in the help menu of flash under actionscript dictionary.

    The scroll up will just be a pop since it's not really a true scroll and that it's going to be only 2 lines, it'll just skip the line and pop into place... Flash doesn't actually animate smoothly, it's more of a flip-book effect if you will.

    the pause isn't a problem, you'd just have a pause function that just does an onEnterframe, counts a certain amount of frames and then deletes itself.. just call the function to pause the hscroll property

    donnie

  15. #35
    Member
    Join Date
    Jul 2003
    Location
    Brampton, ONT
    Posts
    50

    hey Donnie

    I pretty much got what you said ..

    All I wanted it to do now, is to have it scroll vertically, two lines at a time .. maybe even add instancename.alpha = 0 in the script when the scroll ends and beggins again ..

    How did you learn coding in this degree .. did you like lock yourself indoors and worked on it till you got it?? .. I'm still in 'limbo land' trying to atleast write my own code .. I'm I too far from getting there?



    Jess

  16. #36
    Junior Member
    Join Date
    Jul 2003
    Location
    Los Angeles
    Posts
    24
    If you want it to scroll vertically you can add in a piece of code that will set the .scroll += 2
    put that in the if hscroll == maxhscroll and it will scroll by 2 and start from the beginning again.

    That should do the trick...

    Haha, I guess I have been doing it for a while... Don't worry though you'll get there, just keep testing out new pieces of code, never ever skimp on a piece of code though. figure out how it works and re-write it as many times as you can. I remember my friends would try to jack code from other places, it would end up screwing them over. They didn't learn anything and it never worked the way they wanted it too.

    I pretty much sat in my room every other night and tinkered with flash untill I got the hang of it. Then I read every book I could get my hands on... haha, I can reccomend a few for reading, and a few for reference. Books help out a great deal, when you are trying to figure out how something works, odds are they will have some sort of an answer for you.

    I also took on Developer challanges when I worked at my other job in College. I was the lead Flash Developer there, and frequently when there wasn't too much to do at work the other programmers and I would try and come up with "something cool" that flash didn't do straight away, and see if I could code it to their exact wishes.... odds are I usually could figure it out.

    I don't think you're too far off, you're learning it as it is now, I've had to forget a lot of bad flash 5 habits. Plus if you can pick apart my code and understand where it is trying to go then you are just about there. It's all just understanding the logic... once you have that under your belt then it's just a matter of memorizing the syntax.

    Donnie

  17. #37
    Member
    Join Date
    Jul 2003
    Location
    Brampton, ONT
    Posts
    50

    Update

    Power back on .. back to biz ..

    I'm still working on the site .. so far so good ..

    When you get the chance .. check this site out ..

    www.whokilledtheidea.bmw.com

    See the menu they are using? Im trying to create one like it ..

    Need your HELP!

    Laterz
    Jess

  18. #38
    Junior Member
    Join Date
    Jul 2003
    Location
    Los Angeles
    Posts
    24
    Wow, those power outages were a bit on the crazy side... I have a few friends in New York that were effected by it. Strange.

    Anyway, you're pretty ambitious to try and tackle that menu. They have a lot of code built into it, and you'd have to specify exactly what you'd want to have anything work correctly on it... It's not a build as you go type of thing, you have to know exactly how you want it to be implemented, function, and react when in the stage environment. such as:

    do you notice how the angles between each line are equal to the one preceeding it?
    that's not just coincidence.

    The drawing methods used in this are simple but there are many ways that this menu can be put together.

    and that's just the beginning... do you want the menu tree to rely all upon code, and if so you may want to look up object oriented coding structures. by adding another child to a menu tree that would automatically make the choice available to you by code.

    the code for the equidistance of the lines would be semi-easy, just base the angle of the lines: "a" by the sum of all angles in a circle: 360, divided by the number of selections: "num"

    a = 360/num

    that will give you the angle that the lines are supposed to be apart, then the movement is a math function that will update the line, or re-draw the line:

    Math.easeOut = function(t,b,c,d){
    t/=d;
    t--;
    return c*(t*t*t*t*t+1)+b
    }

    where t = time incremented;
    b = beginning value
    c = change in value;
    d = duration;

    umm, what else....

    oh, yea so it just depends on how you want to build that menu. you've got to plan it exactly as you want it to be implemented... otherwise you could waste a lot of time.

    donnie
    pixelrot.com

  19. #39
    Member
    Join Date
    Jul 2003
    Location
    Brampton, ONT
    Posts
    50

    wow

    HI Donnie .. looks like its crazy mad coding .. I was looking at it and did notice the angles are the same ..

    But where should I begin? .. I'll work on it .. promise, I'll try and follow .. we can even exchange files and stuff .. do you want to give it a whirl? ..

  20. #40
    Junior Member
    Join Date
    Jul 2003
    Location
    Los Angeles
    Posts
    24
    Well,

    wow, I think so...

    It is going to be mad crazy coding, but you've got to remember to make and exact schematic before you even attempt any code on it at all. You need to work out every last detail that you want this thing to do, and how it's going to do it. One little add on can potentially take you all the way back to square one.... believe me I know.

    My suggestion is to brainstorm first, figure out what you are going to build into the menu, then write everything you can think of down, don't worry about the order as of yet. Once you have that done you can put it together in a readable format and it should be a diagram of what you want to do... then the code begins.

    I will definitely help you as much as I can, just make sure to do all that and it should go pretty smoothly.

    Donnie
    pixelrot.com

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