Swf xml Html form
Hello, and thanks in advance for your help, I have a swf email form with image rotator which works fine when i pull it up in localhost or just preview the swf file on my server however when I open it via the html link the logo and images wont show noob to actionscript xml/flash help pls, exp:
images and logo show via localhost and in server preview.swf just to show example
//i39.tinypic.com/qp48yg.jpg
images wont show via html url
//i41.tinypic.com/mvgfg5.jpg
Swf Code
import flash.events.TimerEvent;
import fl.transitions.Tween;
import fl.transitions.easing.Strong;
import fl.transitions.TweenEvent;
//Variables for our image rotator
var xml:XML;
var imagesVector:Vector.<Loader> = new Vector.<Loader>();
var urlLoader:URLLoader;
var imagesCounter:Number=0;
var timer:Timer;
var indexCounter:Number=0;
var lastCount:int;
var tween:Tween;
var addTween:Tween;
var loader:Loader = new Loader();
loadXML("xml/images.xml");
// Loading XML Data
function loadXML(url:String):void {
urlLoader=new URLLoader(new URLRequest(url));
urlLoader.addEventListener(Event.COMPLETE, parseXML);
}
// Processing XML Data
function parseXML(e:Event):void {
xml=new XML(e.target.data);
timer = new Timer(xml.@period);
if (xml.children().length()==1){
loadImage();
} else {
loadImages();
}
}
//////////////////////////////////////////////////////////////////////////
//Block of code that is needed, when there is just one image in XML file//
//////////////////////////////////////////////////////////////////////////
function loadImage():void {
loader.load(new URLRequest(xml.children().@src));
loader.contentLoaderInfo.addEventListener(Event.CO MPLETE, imageLoaded);
}
function imageLoaded(e:Event):void {
images_con.addChild(loader);
addTween=new Tween(loader,"alpha",Strong.easeInOut,0,1,0.5,true );
addTween=new Tween(preloader,"alpha",Strong.easeInOut,1,0,0.5,t rue);
}
////////////////////////////////
// Function that loads images
function loadImages():void {
for (var i:int = 0; i < xml.children().length(); i++) {
var imagesLoader:Loader = new Loader();
imagesLoader.load(new URLRequest(xml.children()[i].@src));
imagesVector.push(imagesLoader);
imagesLoader.contentLoaderInfo.addEventListener(Ev ent.COMPLETE, loaderStatus);
}
}
// Function that starts animation when all images is loaded
function loaderStatus(e:Event):void {
imagesCounter++;
if (imagesCounter==imagesVector.length) {
addImages();
timer.addEventListener(TimerEvent.TIMER, imageChange);
timer.start();
}
}
// Function that keep images changing
function imageChange(e:Event):void {
lastCount=indexCounter;
tween=new Tween(imagesVector[indexCounter],"alpha",Strong.easeInOut,1,0,1,true);
tween.addEventListener(TweenEvent.MOTION_FINISH,re turnImageDepth);
indexCounter++;
if (indexCounter==imagesVector.length) {
indexCounter=0;
}
}
//Sets last image backwards and makes it visible
function returnImageDepth(e:TweenEvent):void {
images_con.setChildIndex(imagesVector[lastCount], 0);
imagesVector[lastCount].alpha=1;
}
//Makes all images visible when they added into the stage, also makes preloader invisible
function returnVectorDepth(e:TweenEvent):void {
for (var i:int=1 ; i < imagesVector.length ; i++) {
imagesVector[i].alpha=1;
addTween=new Tween(preloader,"alpha",Strong.easeInOut,1,0,0.5,t rue);
}
}
//Adds images to stage with smooth animation
function addImages():void {
for (var i:int = imagesVector.length - 1; i >= 0; i--) {
images_con.addChild(imagesVector[i]);
imagesVector[i].alpha=0;
}
addTween=new Tween(imagesVector[indexCounter],"alpha",Strong.easeInOut,0,1,0.5,true);
addTween.addEventListener(TweenEvent.MOTION_FINISH , returnVectorDepth);
}
|