A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: [F8] Import Images From XML and Assign Linkage Identifiers?

  1. #1
    Senior Member foochuck's Avatar
    Join Date
    Aug 2000
    Location
    Estero, FL
    Posts
    522

    [F8] Import Images From XML and Assign Linkage Identifiers?

    I'd like to import images from an XML file and then assign linkage identifiers to each image that I import.

    I can take care of importing from XML, but what I need to do next is:

    Turn each image into a movie clip
    Assign each movie clip a linkage identifier

    The reason I want to assign linkage identifiers is because I use a transitions component that I feed linkage identifiers from the movie clips I want to run in the transitions component.
    Foochuck
    http://www.myspace.com/foochuck

  2. #2
    Get Squared Away.
    Join Date
    Feb 2000
    Location
    Allentown, PA
    Posts
    543
    I would store all of my xml in an array, then loop through the array, each time creating an empty movie clip.

    Something like:

    Code:
    for(i = 0; i<array.length; i++){
         var myImgHolder:MovieClip = this.createEmptyMovieClip("myImg", "myImg"+i, i);
         myImgHolder.loadMovie(array.imgURL);
    }
    This will give you however many movieclips as the length of your xml, each having an instance name of "myImg0", "myImg1", "myImg2" etc.

    Hope that steers you in the right direction

  3. #3
    Member
    Join Date
    Apr 2007
    Posts
    31
    Yeah but that doesn't assign linkage identifiers. I had wondered this myself, but I just ended up using loadmovie except with a swf, and in the swf I had the extra images with linkage names.

  4. #4
    Get Squared Away.
    Join Date
    Feb 2000
    Location
    Allentown, PA
    Posts
    543
    Quote Originally Posted by Blommestein
    Yeah but that doesn't assign linkage identifiers. I had wondered this myself, but I just ended up using loadmovie except with a swf, and in the swf I had the extra images with linkage names.

    Sure it does. The first parameter passed to createEmptyMovieClip is the instance name (linkage identifier) of that clip.

    as in:

    Code:
    for(i=0; i<10; i++){
        this.createEmptyMovieClip("myImg"+i, i);
    }
    that will create 10 mc's on the stage with 10 different linkage identifiers, myImg0 - myImg9

  5. #5
    Senior Member foochuck's Avatar
    Join Date
    Aug 2000
    Location
    Estero, FL
    Posts
    522
    myImg is the linkage identifier or the instance name?
    Foochuck
    http://www.myspace.com/foochuck

  6. #6
    Get Squared Away.
    Join Date
    Feb 2000
    Location
    Allentown, PA
    Posts
    543
    You are assigning an instance name via actionscript...which is essentially the same thing as a linkage identifier...a means for you to access that clip

  7. #7
    Member
    Join Date
    Apr 2007
    Posts
    31
    Linkage Identifiers let you create images on the stage from your library. Im assuming with yours, and instance names, you can only refer to those particular created ones, you cannot attach more of those images to a movieclip using those instance names, thats what linkage identifiers are fore.

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