Please Help! XML load Horizontal/Vertical

[COLOR=red]Please anyone![/COLOR]

I went through the tutorial on the website to create a slideshow using xml linked images. My problem is I want to use it for Horizontal and Vertical pictures both. Does anyone know a way around the alignment problem? All images align at top left of the loader box making one or the other offcentered.

[COLOR=blue]1.) Is there a simple way around this?[/COLOR]
[COLOR=blue]2.) Is there a way to get the xscale or yxcale to determine whether the image loading is vertical or horizontal and then based on that to have an If statement and load all Horizontal images into a one movieclip and all others(vertical) into another movieclip.[/COLOR]

I have wasted several hours trying to figure this out and am officially about to give up. Hoping a flash guru can help me out.:sen:

Thanks in advance!!!
Casey

Use a separte movieClip to load the image and then after onLoadInit Event you can get the height/width/xscale/yscale of the movieClip where it is loaded by default the height/… etc parameter are of the image loaded.
So after that you can adjust the positions.

its best if you make them all the same size, there are scripts out there that can handle variety of sizes

hor and vert as the bounchy guy says you will have to detect once they are loaded ie if heigh> width do this else do that

this topic comes up a lot search the forums

[quote=sudhansurana;2333505]Use a separte movieClip to load the image and then after onLoadInit Event you can get the height/width/xscale/yscale of the movieClip where it is loaded by default the height/… etc parameter are of the image loaded.
So after that you can adjust the positions.[/quote]

------------>
[COLOR=Blue]Thanks for your posts. Will you review the below!

I cannot resize the pictures as they have to stay horizontally and vertically aligned. I tried to center them in photoshop with a transparent background and load them as .PNG files but that did not work, some reason it would not show an image.

Can you help me with the specific code I would need to get the object height once it’s in the movie clip? I would like to load into two different movieclips, one horizontally and one vertically centered. If I can get the height value I can do an If statement to determine if the height equals a vertical picture if so would load into the vertical movieclip instance and if not would load into the Horizontal movieclip instance. I have tried at this bugger for a long time, and finally given up to ask someone wiser than I.

I appreciate all and any help you can provide![/COLOR]

[FONT=Courier New][SIZE=2][COLOR=DarkRed]((( I am using the code from this link: http://www.kirupa.com/developer/mx2004/xml_flash_photogallery.htm )))[/COLOR][/SIZE][/FONT]
[COLOR=Blue] ActionScript Code: [/COLOR]

see this
http://anujmehrotra.info/amazingflash/slidextreme/
(sorry the link is dead)

(sorry there is no preloader so , just wait a little for images to load)

basically you have to remember that you cannot load all the images at once… you have to do this synchronously. (for controlled results, though you can have many other methods too :slight_smile: )

load one image… when loading completes find out the width of the loaded image and create a movie clip after calculated distance

using:

next position = current position + loadedclip._width + gap;

[quote=sparkdemon;2333730]see this
http://anujmehrotra.info/amazingflash/slidextreme/

(sorry there is no preloader so , just wait a little for images to load)

basically you have to remember that you cannot load all the images at once… you have to do this synchronously. (for controlled results, though you can have many other methods too :slight_smile: )

load one image… when loading completes find out the width of the loaded image and create a movie clip after calculated distance

using:

next position = current position + loadedclip._width + gap;[/quote]
------->
[COLOR=Blue]Can you expound on that a little more? I am somewhat new to all the flash scripting. What code would I use to create the movieclip for this loaded image? Is the “next position” and “current position” variables? Forgive me for I am unlearned:asleep:

Thanks[/COLOR]

well so am i :slight_smile:

by the way… declare a global variable called GlobalX=0;

then parse the xml or whatever and store into an array.

create another global variable called pointer=0;

now say you call a function loadThumbnail|()

the code roughly will be something like this: this is in oops format… neverthless just look through the logic:

private function onXMLLoaded(success:Boolean)
{
if (success)
{
var TOTAL_ITEMS:Number = DATAML.firstChild.childNodes.length;

        for (var i:Number = 0; i < TOTAL_ITEMS; i++)
        {
            var ptr:XMLNode = DATAML.firstChild.childNodes*;
            var slide:Object = new Object();
            slide.id = ptr.childNodes[0].firstChild;
            slide.description = ptr.childNodes[1].firstChild;
            slide.icon = String(ptr.childNodes[2].firstChild);
            slide.big = String(ptr.childNodes[3].firstChild);
            
            RECORD_STORE.push(slide);
        }
        
        render();
    }
}

private function render():Void
{
    // create clips dynamically
    var iconHolder:MovieClip = CONTENT.createEmptyMovieClip("icon" + iconCounter, CONTENT.getNextHighestDepth());
    iconHolder._x = ICON_X;
    
    var icListener:Object=new Object();
    var icLoader:MovieClipLoader = new MovieClipLoader();
    
    icListener.onLoadInit = Delegate.create(this, setIcon);
    icLoader.addListener(icListener);
    icLoader.loadClip(String(RECORD_STORE[iconCounter].icon), iconHolder);
    iconCounter++; // increment the image counter

}

private function setIcon(target:MovieClip):Void
{
    target._y = (slideScroller._height/2)-(target._height/2);
    ICON_X += target._width + 5;
    MovieClip(target).onRelease = loadBigImage;
    MovieClip(target).onRollOver = FXin;
    MovieClip(target).onRollOut = FXout;
    if (iconCounter <= RECORD_STORE.length - 1)
    {
    render(); // load the next image
    }
    else 
    {
        // proceed with rest of the code
    }
}

hope you wont have problem figuring out the variables

[quote=binns789;2333772]------->
[COLOR=Blue]Can you expound on that a little more? I am somewhat new to all the flash scripting. What code would I use to create the movieclip for this loaded image? Is the “next position” and “current position” variables? Forgive me for I am unlearned:asleep:

Thanks[/COLOR][/quote]