Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Loading XML content

From: Creating a Portfolio Web Site Using Flash CS4 Professional

Video: Loading XML content

Loading XML content into Flash isn't quite as easy as, say, loading in a JPEG, but knowing that the XML content can contain anything you want makes it totally worth it and very powerful. So in the Assets folderm in the design folderm if you look in this portfolio folder, you'll find this XML file. So this is what I want to copy and use in my Flash file. So I'll just copy it over to the appropriate place, into my portfolio folder, I will paste it right in there and this is the file I want to load in.

Loading XML content

Loading XML content into Flash isn't quite as easy as, say, loading in a JPEG, but knowing that the XML content can contain anything you want makes it totally worth it and very powerful. So in the Assets folderm in the design folderm if you look in this portfolio folder, you'll find this XML file. So this is what I want to copy and use in my Flash file. So I'll just copy it over to the appropriate place, into my portfolio folder, I will paste it right in there and this is the file I want to load in.

So I'm just going to open up my portfolio.fla file. As I open it up and know that if I close this Actions panel, I'm actually right here on this first frame of the AS layer. So Window>Actions, I'll open this back up and you can see all this code written to load in all of the various thumbnails. But right at the top, if I just hit Return a couple of times, I can make room for loading in the XML. So I'm going to start off just by writing a comment, just going to type in XML and this is going to load in XML is what I want to do.

And the first thing I need to do is create a variable and this is going to be the XMLURLLoader variable. It's a URLLoader and I'm going to create a new one. The URLLoader is great for loading in text content such as XML or TXT file, any sort of text content, I want to use the URLLoader. So I've instantiated, or made a new URLLoader, called XMLURLLoader.

So I encourage you to just always copy and then paste to use any instance name you might have typed in. What I need do to now is go ahead and load in that specific file that I just placed in the portfolio folder. So I'm going to create a new URLRequest right in here, just like that code hinting tells me, and I'm going to do an open parenthesis and open quotes and type in 'portfolio.' This is going to be the URL, of course, portfolio.xml.

That's what I want to load in. So I'm going to close that quote and close the parentheses. And remember there's two parentheses here so I need to add another one right there. So make sure you do that. That's looking good. Now once the XML is loaded, I want to just trace out some of that data, but I do need to create a Listener. So I'm just going to do a Command+V because the XMLURLLoader is what I want to use and I want to add an EventListener for it. And it's going to be an Event and I am going to listen for the COMPLETE.

Once it's completed loading then I want to create a function called processXML. So I've just kind of made up the name of this function, but I do have to remember it because, just below that, I need to create the function to processXML. It's going to go ahead and be an event: Event. It's going to be the method so I need to make sure these two words match up, right now it's looking good and then open curly brace, close curly brace.

So once this XML has been completed loading in, it's going to fire off this function and all I'm going to do is trace and I'm going to trace out the XMLURLLoader and I'm going to get the data from it, because since I'm using this URLLoader class, it enables these various functions to be available. And what I'm accessing here is this data property. So it's going to take this XML and put all the information from that XML into this data property and all I'm doing is tracing it out.

So I'm going to check syntax. It does tell me that it doesn't contain any errors. So I'm feeling pretty good about this. I'll go to Test Movie and this is what I currently have, but if I look in my Output panel, I can see all of that XML content. All of it is in the XML file and now it's in Flash and available and ready to use. So really, if I go back to my Actions panel, you can see that through these lines of code, I'm able to load in an XML file. And of course, the next steps would be to access and start using all of this content, but now that my content is separate from my Flash file, it makes this really powerful when updating my portfolio.

Show transcript

This video is part of

Image for Creating a Portfolio Web Site Using Flash CS4 Professional
 
Expand all | Collapse all
  1. 1m 41s
    1. Welcome
      1m 7s
    2. Using the exercise files
      34s
  2. 24m 1s
    1. Understanding web design
      2m 44s
    2. Creating a Flash file
      3m 18s
    3. Importing a design from Photoshop
      7m 45s
    4. Optimizing the design
      10m 14s
  3. 13m 59s
    1. Dynamically loading an image
      3m 37s
    2. Loading random images
      10m 22s
  4. 47m 38s
    1. Creating menu buttons
      8m 18s
    2. Adding functionality to buttons
      8m 56s
    3. Adding navigation
      9m 45s
    4. Creating transitions
      12m 0s
    5. Simplifying code
      8m 39s
  5. 26m 11s
    1. Creating web site sections
      7m 41s
    2. Dynamically loading sections
      11m 7s
    3. Linking to web sites and email addresses
      7m 23s
  6. 29m 18s
    1. Setting up a portfolio
      12m 31s
    2. Adding functionality to thumbnails
      10m 10s
    3. Allowing for unlimited thumbnails
      6m 37s
  7. 41m 17s
    1. Benefits of using XML
      4m 42s
    2. Loading XML content
      4m 34s
    3. Sorting XML content
      7m 32s
    4. Displaying XML content
      7m 35s
    5. Using XML to create thumbnails
      8m 41s
    6. Displaying content with thumbnails
      8m 13s
  8. 25m 59s
    1. Creating and importing video
      9m 47s
    2. Adding a Full Screen button
      4m 15s
    3. Creating custom video controls
      4m 50s
    4. Adding functionality to video thumbnails
      7m 7s
  9. 9m 12s
    1. Adding audio to buttons
      5m 30s
    2. Adding audio to dynamically created buttons
      3m 42s
  10. 21m 19s
    1. Applying professional transitions
      9m 26s
    2. Creating a preloader
      8m 56s
    3. Publishing a web site
      2m 57s
  11. 3m 15s
    1. Reviewing the "corporate" Flash site
      1m 40s
    2. Reviewing the "artistic" Flash site
      1m 35s
  12. 12s
    1. Goodbye
      12s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now "Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Creating a Portfolio Web Site Using Flash CS4 Professional.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.