A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: Loader Component

  1. #1
    the friendly canadian DaVulf's Avatar
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    2,017

    Loader Component

    Hey,

    I was wondering if it is possible to have multiples of these, one fed off another..

    Here is the thing. Currently I have a list fed by XML, and when you click on a list item, an image shows in the loader.

    What I want to have, is that when you click on a list item, an image shows in a big loader, and 5 more smaller images show in smaller loaders. If those are clicked, that image gets shown in the bigger loader.

    I have seen that type of thing with JS, and I'm sure it can be done with Flash, but how can you do it with components?

    Thanks,
    DavUfL

  2. #2
    the friendly canadian DaVulf's Avatar
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    2,017
    Anyone ever seen something like this?

  3. #3
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Which part is the problem?
    1. You need to code somewhere wich images will be shown in the loaders, when you press the list. Should not be too difficult if you use xml.
    2. Then you need to make a button of each of the smaller images, which should also not be a problem. Here is a script, which I modified from some other movie to adjust to loader components.
    PHP Code:
    import mx.utils.Delegate;
    //
    var myArray:Array = new Array ();
    for (var 
    05i++)
    {
        
    _root["mc_" i].contentPath "images/a" ".jpg";
        var 
    myURL:String "images/a" ".jpg";
        
    myArray.push ({th:_root["mc_" i], mu:myURL});
    }
    //
    var eventBroadcaster:Object = new Object ();
    var 
    myListener:Object = new Object ();
    myListener.traceVar setInterval (Delegate.create (thislistener), 1000);
    function 
    listener ()
    {
        if (
    myArray[myArray.length 1].th.getBytesTotal () > 0)
        {
            
    clearInterval (myListener.traceVar);
            for (var 
    0myArray.lengthi++)
            {
                
    myArray[i].th.id i;
                
    myArray[i].th.onPress = function ()
                {
                    
    big_mc.contentPath myArray[this.id].mu;
                };
            }
        }
    }
    AsBroadcaster.initialize (eventBroadcaster);
    eventBroadcaster.addListener (myListener);
    eventBroadcaster.broadcastMessage ("traceVar"); 
    - The right of the People to create Flash movies shall not be infringed. -

  4. #4
    the friendly canadian DaVulf's Avatar
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    2,017
    Thanks Cancer. I'll give it a shot when I get home tonight .

    Basically the issue I was having was with the linking itself. The component inspector lets you set different parameters that are fed off of the XML. I just wasn't sure how to make a loader component also a button, and therefore a feeder for another loader component.

  5. #5
    the friendly canadian DaVulf's Avatar
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    2,017
    Cancer,

    I gave it a shot, but I'm falling a little behind here. I took your code and pasted it into a new .fla, I made some loader components, and tested it out. Everything works perfectly. Now it starts to get more complex, and this is where I am getting lost.

    http://www.briancomeau.net/niveau/projects.html

    This is the webpage I am making for my dad, and you can see how I currently have it laid out. Right now, I have the list component fed by XML that draws from a database the names that I have added through an html form. Currently, when you click on a list item, a description appears in the text component, and an image appears in the loader component.

    Now what I am trying to do is that I will instead have one big image loader, and 5 smaller ones. When you click a list item, all of those boxes change. The big loader changes to the original image it does now, and the small loaders change to other angles or perspectives of the building. Then, if one were to click on the small loaders, the big one would change.

    The reason I am having issues is because I am using the component inspector to set bindings. There is no AS involved, so I am not sure how I can tell the loaders to be bound by the list, but also to be bound by the other loaders once clicked.

    I hope that makes sense.

    Thanks again,
    daVuLf

  6. #6
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    That is where it becomes a dark box. If I do such project I do all coding by myself. I only use the Binding scheme for WebServiceConnector. I don't know it is actually possible to do it with the Binding scheme.
    - The right of the People to create Flash movies shall not be infringed. -

  7. #7
    the friendly canadian DaVulf's Avatar
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    2,017
    I hear ya, I thought that components had to be done through the bindings, which is why I went with that approach. I'm not averse to coding, so it isn't intimidation by any means, I just didn't know it was possible.

    As far as that is concerned, do you have any information on where I could find how to do the bindings with AS instead of the inspector.

    Thanks,
    DaVuLF

  8. #8
    Island Boy
    Join Date
    Apr 2006
    Posts
    655
    if the pictures for the angles or perspectives of the building do not change. Why not add them inside flash and load them up in a movieclip as buttons. From there you can just click on them and the button code will load the larger version into the large loader. You can do it via XML also if that is the route you are going with loading the pictures from a database.

  9. #9
    the friendly canadian DaVulf's Avatar
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    2,017
    VI, I was thinking along those lines, but they need to be modified based on the list component's selection.

  10. #10
    Island Boy
    Join Date
    Apr 2006
    Posts
    655
    that's not a problem. What i meant by modified was if the pictures always stay the same for the building that you load up. You will just keep each set of 5 pictures in it's own movieclip and just load up that MC depending on what option from the list you choose.

  11. #11
    the friendly canadian DaVulf's Avatar
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    2,017
    I think I see what you are saying. Do a check on the list to see if a certain selection is made, and then load the appropriate image.

  12. #12
    Island Boy
    Join Date
    Apr 2006
    Posts
    655
    exactly.... or MC for the list of the 5 other pictures which will load up based on the list option selected.

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