Very Handy!

February 9, 2006 by Rachel Maxim

Thanks for posting a very useful article. I've been looking for some advice on a more complex portfolio Flash app that's well written with some of Flash's newer OO features (so much out there was written for 5 or MX!). I was able to use the info in this article to produce my own portfolio project.

One question I have - about working within the function showImageNumbers. If I want to dynamically load separate swf's instead of numbers/movieClips embedded in the flash file, how do I manage the dynamically named variables? Here's what I'm doing:

for (var i:Number = 0; i < projectNode.childNodes.length; i++) {
    imgNumMC = __thumbnailHolderMC.createEmptyMovieClip("img_"+i, __depthCounter);
    {? what's the movieclip name?}.loadMovie(projectNode.childNodes[i].attributes.filename, __depthCounter);
   }

Thanks!

Rachel

RE: Very Handy!

February 9, 2006 by Sas Jacobs

Hi Rachel

Thanks for the post and I'm glad you found the tutorial useful. To answer your question, you've created new empty movie clips called img_0, img_1 etc. Each time you move through the loop, you reference that clip using the variable imgNumMC. Use that to refer to the empty movie clip within the loop.

In your code, you are trying to load the thumbnail image where the numbers should be so you might want to change the XML document to include a reference to the external button images and change the path from the file attribute.

I'm travelling at the moment so can't write a code sample. If you get stuck, let me know.

Cheers

Sas

Creating dynamic text fields alongside the images

February 16, 2006 by lee pearman

Hi Sas

Many thanks for this informative and well written article. I have found it extremely useful. Being a virtual novice when it comes to dealing with xml files and flash I have found this to be an excellent method for creating a  flash portfolio, both for expandability and reusablity reasons. I have a question that you may be able to provide some advice on. I would like to implement this portfolio as it is, but also add a dynamic text field alongside the images, to display a few lines of information about each image thumbnail. I am not entirely sure how to display selected text. How would i possibly do this? I have looked at the code and can see that I would more than likely need to add more variables to the public function such as the ones created for the buttons and image holders:

  __buttonHolderMC = __galleryMC.createEmptyMovieClip("buttonHolder_mc", __depthCounter);
  __depthCounter ++;
  
  __imgHolderMC = __galleryMC.createEmptyMovieClip("imgHolder_mc", __depthCounter);
  __depthCounter ++;
  __imgHolderMC._x = 160;
  __imgHolderMC._y = 10;
  
  __thumbHolderMC = __galleryMC.createEmptyMovieClip("thumbHolder_mc", __depthCounter);
  __depthCounter ++;
  __thumbHolderMC._x = 160;
  __thumbHolderMC._y = 420;
 }

Is there any way you could provide some code on how to do this. Would i also need to add to the xml file to include the dynamic text that would need to be displayed for each selected thumbnail?

Sorry this is a long post, but it would be helpful to have some expert help as my brain is too inferior to work this all out at this stage!!

Thanks,

Lee Pearman email: lee.pearman@ntlworld.com

 

RE: Creating dynamic text fields alongside the images

February 19, 2006 by Sas Jacobs

Hi Lee

I'm glad you've enjoyed the article. Sorry about the delay in responding but I was in Sydney last week on holiday.

You've certainly asked for a rewrite of the application! There's quite a bit involved. Rather than write the code for you, I'll give you some pointers so you can work it out yourself.

First, as you rightly say, you'll need to change the structure of the XML document to include the text that you want to display. Add a new element to the XML document, making sure that you don't include special characters like quotes, ampersands or < and > signs.

Then, you'll need to create a text field in the __galleryMC movie clip using ActionScript, and position it on the Stage. Make sure you allow it to be multiline. Use the same approach as for the other elements, creating a private variable to reference the text field. You can then grab the text from the XML document and add it to the text property of the text field.

Good luck and post again if you get stuck!

Sas

See all 10 Reviews