A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 21

Thread: XML for my portfolio

  1. #1
    Dumbass grBMXer's Avatar
    Join Date
    May 2002
    Location
    Grand Rapids, MI, USA
    Posts
    212

    XML for my portfolio

    Hi, I was wondering how I could set my portfolio section up sort of like on kurtnoble.com. Completely running of xml. I would like to have it set up so it's like a thumbnail for each project but then when you click it it resizes and shows you text info on the project and a launch project button. How do I do this using xml? Do I create one clip then duplicate it? How would I go about setting that up. I would like to keep the effects and not just load the xml in. If someone could show or point me towards a tutorial that I could learn this at I would appreciate it. Thanks in advance!

  2. #2
    Dumbass grBMXer's Avatar
    Join Date
    May 2002
    Location
    Grand Rapids, MI, USA
    Posts
    212
    Anybody?

  3. #3
    Member
    Join Date
    Feb 2003
    Location
    Houston, TX
    Posts
    62
    you are going to have to write your actionscript to dynamically create these sections. I am working on something very similar for my own website. With XML even though you can use all the parentnode, nextchild and other BS. I prefer to just look at my XML as Arrays with in arrays. my XML would look similar to this.

    <client
    name="clients name"
    description="more stuff here"
    photo="clientphoto.jpg"
    link="http://www.clientssite.com"
    />
    <client
    name="clients name"
    description="more stuff here"
    photo="clientphoto.jpg"
    link="http://www.clientssite.com"
    />
    <client
    name="clients name"
    description="more stuff here"
    photo="clientphoto.jpg"
    link="http://www.clientssite.com"
    />

    after loading my XML into the XML object. I get my values like this
    myXMLobject.childNodes[x].attributes.name
    in this x represents the index in my XML where 0 = first node, 1 = second node, 2 = third node, and so forth
    I start out with x=0 and continue incrementing it until the value = undefined.

    You are going to have to dynamically create movie clips with one another to display a list of your websites. that is the bare logic explaination of how to do this, I can post some actionscript code if you really need. Hope this helps you out a little.
    Paul

  4. #4
    Dumbass grBMXer's Avatar
    Join Date
    May 2002
    Location
    Grand Rapids, MI, USA
    Posts
    212
    Hey fzr600man,

    Thanks for the xml code. It looks alot more simple than I thought it would so I appreciate that. I don't quite understand how to write out the AS for it yet. Do I create a little mc template and then duplicate it for the number of sites in my xml? If so how. Some action script would be appreciated. Thanks for your help already.

    Also. When it comes to loading the pics in, does the mc not load in til the pic does or how does that work with xml? Thanks again for your help so far, hope to hear back from you soon. Thanks man!

    P.S. I noticed your name, do you happen to ride?
    [+] Website. http://www.evanbartlett.com/
    [+] Email. evan@evanbartlett.com
    [+] AIM. emDUB123456789
    [+] Yahoo! evanem1

  5. #5
    Member
    Join Date
    Feb 2003
    Location
    Houston, TX
    Posts
    62
    I will get you some actionscript that should help you out. I remember when I first was trying to learn XML. I had prethought it to be much more complicated than it actually was. Keep in mind that XML really only serves as storing character strings and number values. so your website photos will basically load as fast as your internet connection. I would do a little preloader on your movie clip so your data all comes in at once. It will all make sense when I post my actionscript for you. And yeah I used to ride a 97 FZR600R. Got married, and sold the bike.

  6. #6
    Dumbass grBMXer's Avatar
    Join Date
    May 2002
    Location
    Grand Rapids, MI, USA
    Posts
    212
    Oh cool man. Thanks for helping me out. Can't wait to see the script. Yeah I prethought it all and I thought of alot of things that weren't needed and just complicated myself more than I should have been. Oh that's cool. Yeah everyone gets married and stops riding these days. I bmx, not motorcycles, but my dad rides and races motorcycles and alot of my friends race mx. Oh well just thought I would ask because of your name. Thanks again for all the help! You rock.
    [+] Website. http://www.evanbartlett.com/
    [+] Email. evan@evanbartlett.com
    [+] AIM. emDUB123456789
    [+] Yahoo! evanem1

  7. #7
    Member
    Join Date
    Feb 2003
    Location
    Houston, TX
    Posts
    62
    ok man what I recommend you do, is create a new movie clip.
    On frame 1 put in this action script;

    sideloaded=false;
    clients = new XML();
    clients.ignoreWhite=true;
    clients.load("clients.xml");
    clients.onLoad = function(success){
    if(success){
    sideloaded=true;
    }
    }


    then on frame 16 put in this( 1 - 16 should be some loading effect)

    if(sideloaded){
    play();
    }
    else{
    gotoAndPlay(2);
    }

    What this does is loads your XML, and makes sure its loaded before continuing on. Then between frames 16 and 34 I have a cool effect that went from the end of loading phase to the actual layout.

    on frame 35 I have the following

    x=0;
    w=150;
    h=20;
    ypos=0;
    this.createEmptyMovieClip("clientlist",2);
    this.clientscroller.setScrollContent(clientlist);

    clientscroller is the static scrollpane I created, make sure you set your linkage up to export for actionscript for this object.

    ok here is the fun part on frame 39;

    if(clients.childNodes[x].attributes.name!=undefined){

    mytext=" "+clients.childNodes[x].attributes.name.toString();
    clientlist.createEmptyMovieClip(["client"+x], 3+x);
    clientlist["client"+x]._y=ypos;

    clientlist["client"+x].attachMovie("cornerclip",["roundback"+x],4+x);

    clientlist["client"+x].createTextField("textfield", 5+x, 3, 3, w, h);
    clientlist["client"+x].textfield.multiline = false;
    clientlist["client"+x].textfield.wordWrap = false;
    clientlist["client"+x].textfield.border = false;
    clientlist["client"+x].textfield.borderColor = 0xFFFFFF;
    clientlist["client"+x].textfield.embedFonts = true;
    clientlist["client"+x].textfield.background = false;
    clientlist["client"+x].textfield.backgroundColor = 0x6666CC;
    clientlist["client"+x].textfield.text = String(myText);

    txtFormat = new TextFormat();
    txtFormat.bullet = false;
    txtFormat.underline = false;
    txtFormat.font = "Shruti";
    txtFormat.size = 10;
    txtFormat.color = 0x000000;

    clientlist["client"+x].textfield.setTextFormat(txtFormat);

    clientlist["client"+x].onRollOver = function(){
    this.attachMovie("sideovereffect", "effect", x+4);
    this.effect._x=1;
    }
    clientlist["client"+x].onPress = function(){
    getURL("main.htm", "_blank");
    }
    clientlist["client"+x].onRollOut = function(){
    this.effect.removeMovieClip();
    }
    ypos+=23;
    x++;
    this.clientscroller.refreshPane();

    gotoAndPlay(38);
    }
    else{
    stop();
    _root.play();
    }

    Just to help you out on a few things,
    roundback is a movie clip effect I used for the backrounds
    sideovereffect is a movie clip I used for the rollovers.
    This is cool because it loads all your sites one a time

    here is the XML I used for this

    <website
    name="GRUV Alcohol Beverage"
    URL="http://www.gruvusa.com"
    description="Full flash site developed for new beverage company."
    />
    <website
    name="GRUV Alcohol Beverage"
    URL="http://www.gruvusa.com"
    description="Full flash site developed for new beverage company."
    />
    <website
    name="GRUV Alcohol Beverage"
    URL="http://www.gruvusa.com"
    description="Full flash site developed for new beverage company."
    />
    <website
    name="GRUV Alcohol Beverage"
    URL="http://www.gruvusa.com"
    description="Full flash site developed for new beverage company."
    />
    <website
    name="GRUV Alcohol Beverage"
    URL="http://www.gruvusa.com"
    description="Full flash site developed for new beverage company."
    />

    I hope you get the jist of it. Good luck. by the way I checked out your website, and I like your design, very nice, XML will complement your design very nicely.

  8. #8
    Member
    Join Date
    Feb 2003
    Location
    Houston, TX
    Posts
    62
    let me redo that the XML should look more like this, just remove the
    "//" that comment it out.
    // <website
    // name="GRUV Alcohol Beverage"
    // URL="http://www.gruvusa.com"
    // description="Full flash site developed for new beverage company."
    // />

    that is just for a single node though, make more of these for each of your sites. This code was just for a listing of your sites, I still am working on getting it to create my content panel

  9. #9
    Member
    Join Date
    Feb 2003
    Location
    Houston, TX
    Posts
    62
    what the hell!!! ok hold on

    [PHP]
    <website
    name="GRUV Alcohol Beverage"
    URL="http://www.gruvusa.com"
    description="Full flash site developed for new beverage company."
    />

  10. #10
    Member
    Join Date
    Feb 2003
    Location
    Houston, TX
    Posts
    62
    (stupid thing goes here) website
    name="GRUV Alcohol Beverage"
    URL="http://www.gruvusa.com"
    description="Full flash site developed for new beverage company."
    />

    each of your nodes will look like this

  11. #11
    Dumbass grBMXer's Avatar
    Join Date
    May 2002
    Location
    Grand Rapids, MI, USA
    Posts
    212
    Woah man that's alot of code. Thanks alot for that. I'm beginning to like this. As for loading it. When I make the new clip how does it know exactly where in the clip to load what? Also how would I load in a picture for each project? Is there possibly an open source .fla anywhere on the web I could check out to see how it all works? Let me know. I wouldn't use the .fla. Just play with it to see how exactly everything is set up and how everything works. Thanks man!
    [+] Website. http://www.evanbartlett.com/
    [+] Email. evan@evanbartlett.com
    [+] AIM. emDUB123456789
    [+] Yahoo! evanem1

  12. #12
    Dumbass grBMXer's Avatar
    Join Date
    May 2002
    Location
    Grand Rapids, MI, USA
    Posts
    212
    Oh and thanks for the kind words regarding my site. I also think xml would suit it nicely.
    [+] Website. http://www.evanbartlett.com/
    [+] Email. evan@evanbartlett.com
    [+] AIM. emDUB123456789
    [+] Yahoo! evanem1

  13. #13
    Member
    Join Date
    Feb 2003
    Location
    Houston, TX
    Posts
    62
    Code:
    <website
      name="GRUV Alcohol Beverage"
      URL="http://www.gruvusa.com"
      description="Full flash site developed for new beverage company."
    />
    <website
      name="GRUV Alcohol Beverage"
      URL="http://www.gruvusa.com"
      description="Full flash site developed for new beverage company."
    />
    <website
      name="GRUV Alcohol Beverage"
      URL="http://www.gruvusa.com"
      description="Full flash site developed for new beverage company."
    />
    damit!!!

  14. #14
    Dumbass grBMXer's Avatar
    Join Date
    May 2002
    Location
    Grand Rapids, MI, USA
    Posts
    212
    Having troubles?
    [+] Website. http://www.evanbartlett.com/
    [+] Email. evan@evanbartlett.com
    [+] AIM. emDUB123456789
    [+] Yahoo! evanem1

  15. #15
    Member
    Join Date
    Feb 2003
    Location
    Houston, TX
    Posts
    62
    yeah I can't get the code tag to work, I will email you the fla, swf, and XML files.

  16. #16
    Member
    Join Date
    Feb 2001
    Location
    Barcelona, Spain
    Posts
    93
    Hi guys,

    I'd be really interested to see how you got this to work as I'm starting to learn how to use xml.

    Would it b possible to upload or email me the files that you were talking of here.

    Thanks,

    Lenny. <leonard_770@hotmail.com>

  17. #17
    Senior Member QBA's Avatar
    Join Date
    Feb 2001
    Location
    Toronto, Canada
    Posts
    312

    Movie variable

    Thanks fzr600man.

    The script is very nice but I have a quick question?

    How flash setup a variable to handle the newly created movieclip:
    Example:

    this.createEmptyMovieClip("clientlist",2);
    this.clientscroller.setScrollContent(clientlist);

    Is clientlist already a variable. Where did you set it up as a variable.

    I tried a simple test like
    this.createEmptyMovieClip("mymovie",0);

    mymovie.createTextField("mytext",1,100,100,300,100 );
    mytext.multiline = true;
    mytext.wordWrap = true;
    mytext.border = false;

    myformat = new TextFormat();
    myformat.color = 0xff0000;
    myformat.bullet = false;
    myformat.underline = true;

    mytext.text = "this is my first test field object text";
    mytext.setTextFormat(myformat);

    And it is not showing the text. But if I do something like
    createTextField("mytext",1,100,100,300,100); it does work.

    Any idea?

    Best regards

  18. #18
    Japanese l337 TRJNET's Avatar
    Join Date
    Mar 2001
    Location
    Toronto, Canada
    Posts
    399
    use the php tags, they tag XML coding very nicely with color-coding

    Here's an example: (look at the very last reply) http://www.flashkit.com/board/showth...hreadid=470897
    consultant / contractor / designer

  19. #19
    Member
    Join Date
    Feb 2003
    Location
    Houston, TX
    Posts
    62
    Thanks man!!
    helping others out on this MB has been horrible, thanks to you I can now post my examples cleanly. It has been most appreciated!!!

    Paul

  20. #20
    Member
    Join Date
    Feb 2003
    Location
    Houston, TX
    Posts
    62

    Re: Movie variable

    About the clientlist variable

    this.createEmptyMovieClip("clientlist",2)
    is what initialized this variable.
    and then the next line
    this.clientscroller.setScrollContent(clientlist);
    dropped the Movieclip into my scrollpane
    Another thing to try is make sure your textfields are accending in their layers. Meaning if you setup the original MC to be on layer 1, the next thing should be on layer 2, and so forth. another thing is to make sure you imbed your fonts so that they will show up properly in your text fields, unless you like the rough looking text.
    Hope this helped

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