Alright, I've built this incredible carousel for a portfolio page in a flash website, using an external .XML file for the images;however, after countless hours scouring the web, I can't seem to find the code I need to put in the .XML file, so that clicking on the various pictures will take me to another frame in the flash site. Any help is appreciated, and if needed I can post the XML file data, and AS<AS2>.

Dani AI

Generated

Short expert summary and practical fix (for — and thanks to for the XML/file-size checks)

The symptom you describe (the big blue placeholder never showing the full image) almost always comes from trying to treat the image URL like a property instead of actually loading that URL into the placeholder MovieClip. In AS2 you should load an external image into an existing clip (or into a created clip) — either by calling the MovieClip method or by using MovieClipLoader so you can act when the image is ready. See the MovieClip load guidance for the exact behavior. (flylib.com)

Recommended approach (no copy/paste of your timeline code):

  • Keep a named movie clip on stage (the placeholder). From your click/release handler load the large image into that clip (method form is less error-prone than trying to assign targets to a global function).
  • For reliable sizing and to avoid working with zero-width/height while the file streams, use MovieClipLoader.loadClip and a listener for onLoadInit or onLoadComplete; only then read the loaded clip’s _width/_height and set _xscale/_yscale (or compute a scale factor to preserve aspect ratio and fit). MovieClipLoader also gives onLoadError so you can catch bad paths. (flylib.com)

Practical troubleshooting checklist

  • Confirm the XML attribute holding the large-image URL is correct and case‑matches the filename (paths are relative to the SWF’s timeline that issued the load).
  • If you need to constrain huge images, either pre-resize/compress (preferred) or resize in onLoadInit after you read the real loaded dimensions. Image optimization practices will help avoid oversized JPGs that fail to publish or cause memory issues. (open-flash.github.io)

Note: this thread is about AS2/Flash-era tooling; Flash Player was retired and blocked by vendors after 2020, so keep that in mind for long-term deployment. (adobe.com)

Recommended Answers

All 7 Replies

Member Avatar for Member #334542

Yes post your xml file and if possible fla file here. And I did not get you,

Whether you created the .XML file with proper structure and included your image path there?

You written any code in the timeline to utilitze the XML?

Or you asking how to write code to fetch data from XML?

I suppose my initial question wasn't real clear, lol, ok, I have the code in to fetch the data from the XML, I'm using Lee Brimelow's 3D Carousel Tutorial using AS2. I have it nearly complete, the problem I am having is rather then a TEXT field, I am wanting to have a full size image of the thumbnail pop up where Lee has his paragraph. I'm using this as a portfolio page in my flash website for my graphic design work. I'll get it all zipped up with the XML/FLA/images etc in it and posted here shortly. I hope thats a better explanation.

ok, here is the zip file containing my FLA/XML/images etc etc, the problem is in line 83 of the code in the FLA.

The original Tut, uses a dynamic text field, where i have the blue square movie clip, so the code used for that line in the tut obviously won't work(I did try it, hoping it would); my thought process was that since I used movie clip placeholders for the carousel image thumbnails, why not use the same method for the full size image. I just can't seem to get the code to work for it, and all I get is the big blue square.

Currently I've changed the movieclip name to fullImage, and tried redoing the command line in question to read

fullImage.image = t.content
MovieClip.fullImage = t.content
fullImage.MovieClip = t.content

all of which have failed to produce the desired result.
Going to go look for more ideas, and see if i can come up with something.

After brainstorming with a friend who is better at AS then I am, we came up with the idea to simply have the little icon a fullsize image, thats just scaled WAY down, however, looking through the code, neither of us is really sure on where to do the scaling on the icons; I have an idea where to put the scale up when you click, here's the full code

import mx.utils.Delegate;
import mx.transitions.Tween;
import mx.transitions.easing.*;

var numOfItems:Number;
var radiusX:Number = 300;
var radiusY:Number = 95;
var centerX:Number = Stage.width/2;
var centerY:Number = Stage.height/2;
var speed:Number = 0.02;
var perspective:Number = 130;
var home:MovieClip = this;
fullImage._alpha = 0;

var tooltip:MovieClip = this.attachMovie("tooltip","tooltip",10000);
tooltip._alpha = 0;

var xml:XML = new XML();
xml.ignoreWhite = true;

xml.onLoad = function()
{
	var nodes = this.firstChild.childNodes;
	numOfItems = nodes.length;
	for(var i=0;i<numOfItems;i++)
	{
		var t = home.attachMovie("item","item"+i,i+1);
		t.angle = i * ((Math.PI*2)/numOfItems);
		t.onEnterFrame = mover;
		t.toolText = nodes[i].attributes.tooltip;
		t.content = nodes[i].attributes.content;
		t.icon.inner.loadMovie(nodes[i].attributes.image);
		t.ref.inner.loadMovie(nodes[i].attributes.image);
		t.icon.onRollOver = over;
		t.icon.onRollOut = out;
		t.icon.onRelease = released;
	}
}


function over()
{
	home.tooltip.tipText.text = this._parent.toolText;
	home.tooltip._x = this._parent._x;
	home.tooltip._y = this._parent._y - this._parent._height/2;
	home.tooltip.onEnterFrame = Delegate.create(this,movetip);
	home.tooltip._alpha = 100;
}

function out()
{
	delete home.tooltip.onEnterFrame;
	home.tooltip._alpha = 0;
}

function released()
{
	home.tooltip._alpha = 0;
	for(var i=0;i<numOfItems;i++)
	{
		var t:MovieClip = home["item"+i];
		t.xPos = t._x;
		t.yPos = t._y;
		t.theScale = t._xscale;
		delete t.icon.onRollOver;
		delete t.icon.onRollOut;
		delete t.icon.onRelease;
		delete t.onEnterFrame;
		if(t != this._parent)
		{
			var tw:Tween = new Tween(t,"_xscale",Strong.easeOut,t._xscale,0,1,true);
			var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,t._yscale,0,1,true);
			var tw3:Tween = new Tween(t,"_alpha",Strong.easeOut,100,0,1,true);
		}
		else
		{
			var tw:Tween = new Tween(t,"_xscale",Strong.easeOut,t._xscale,100,1,true);
			var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,t._yscale,100,1,true);
			var tw3:Tween = new Tween(t,"_x",Strong.easeOut,t._x,160,1,true);
			var tw4:Tween = new Tween(t,"_y",Strong.easeOut,t._y,450,1,true);
			var tw5:Tween = new Tween(fullImage,"_alpha",Strong.easeOut,0,100,1,true);
			// image, needs fixed to work!!!!!
			loadMovie.fullImage = icons.content;
			var s:Object = this;
			tw.onMotionStopped = function()
			{
				s.onRelease = unReleased
			}
		}
	}
}

function unReleased()
{
	delete this.onRelease;
	var tw:Tween = new Tween(fullImage,"_alpha",Strong.easeOut,100,0,.5,true);
	for(var i=0;i<numOfItems;i++)
	{
		var t:MovieClip = home["item"+i];
		if(t != this._parent)
		{
			var tw:Tween = new Tween(t,"_xscale",Strong.easeOut,0,t.theScale,1,true);
			var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,0,t.theScale,1,true);
			var tw3:Tween = new Tween(t,"_alpha",Strong.easeOut,0,100,1,true);
		}
		else
		{
			var tw:Tween = new Tween(t,"_xscale",Strong.easeOut,100,t.theScale,1,true);
			var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,100,t.theScale,1,true);
			var tw3:Tween = new Tween(t,"_x",Strong.easeOut,t._x,t.xPos,1,true);
			var tw4:Tween = new Tween(t,"_y",Strong.easeOut,t._y,t.yPos,1,true); 
			var s:Object = this;
			tw.onMotionStopped = function()
			{
				{
					for(var i=0;i<numOfItems;i++)
					{
						var t:MovieClip = home["item"+i];
						t.icon.onRollOver = Delegate.create(t.icon,over);
						t.icon.onRollOut = Delegate.create(t.icon,out);
						t.icon.onRelease = Delegate.create(t.icon,released);
						t.onEnterFrame = mover;
					}
				}
			}
		}
	}
}

function movetip()
{
	home.tooltip._x = this._parent._x;
	home.tooltip._y = this._parent._y - this._parent._height/8;
}

xml.load("icons.xml");

function mover()
{
	this._x = Math.cos(this.angle) * radiusX + centerX;
	this._y = Math.sin(this.angle) * radiusY + centerY;
	var s:Number = (this._y-perspective) / (centerY+radiusY-perspective);
	this._xscale = this._yscale = s * 100;
	this.angle += this._parent.speed;
	this.swapDepths(Math.round(this._xscale) + 100);
}

this.onMouseMove = function()
{
	speed = (this._xmouse-centerX) / 4500;
}

I'm pretty sure that the scale coding will come between lines 20-40, going to play with that hope it works, and I can find the code I need.

Line 83 is where I'm having the issue on the big picture not loading like its supposed, I just get the blue square movieclip placeholder.

Any help on either fixing the movieclip to load my image from the XML or where to do the sizing would be great.

Member Avatar for Member #334542

After an hour, found the solution. I had downloaded your zip file and made two changes. No name conventions are altered. So Please download the same and make the changes mentioned in the attachment.

1. Open the xml and check the content names are correct (Check Case-Sensitive (flower (or) Flower). Give the name as it is in the folder
2. One of your jpeg file is not loaded in the flash output, bcoz of over size (reduce the width and height according to the flash theText movieclip)

COOL!

Thank you SO much, this really makes my day, I was worried I was going to have to scrap it after spending so much time on it.

Thank you again!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.