Load as. xml in flash - prob loading image
I have trouble getting my images to load on my flash stage. I
tried using the movieclipLoaderClass() as you suggested but I can't
get it to work. Appreciate any help.
Then you reuse the code but you move positioning and scaling
to the loadImage() function otherwise your images wiil be at the
same position. And you would want to place the images on their own
depth. Make sure you edit the xml file in row two to point to
image2.jpg and place an image called 'image2.jpg' in the same
folder as your fla.
Similar Messages
-
Problem loading XML-file using SQL*Loader
Hello,
I'm using 9.2 and tryin to load a XML-file using SQL*Loader.
Loader control-file:
LOAD DATA
INFILE *
INTO TABLE BATCH_TABLE TRUNCATE
FIELDS TERMINATED BY ','
FILENAME char(255),
XML_DATA LOBFILE (FILENAME) TERMINATED BY EOF
BEGINDATA
data.xml
The BATCH_TABLE is created as:
CREATE TABLE BATCH_TABLE (
FILENAME VARCHAR2 (50),
XML_DATA SYS.XMLTYPE ) ;
And the data.xml contains the following lines:
<?xml version="2.0" encoding="UTF-8"?>
<!DOCTYPE databatch SYSTEM "databatch.dtd">
<batch>
<record>
<data>
<type>10</type>
</data>
</record>
<record>
<data>
<type>20</type>
</data>
</record>
</batch>
However, the sqlldr gives me an error:
Record 1: Rejected - Error on table BATCH_TABLE, column XML_DATA.
ORA-21700: object does not exist or is marked for delete
ORA-06512: at "SYS.XMLTYPE", line 0
ORA-06512: at line 1
If I remove the first two lines
"<?xml version="2.0" encoding="UTF-8"?>"
and
"<!DOCTYPE databatch SYSTEM "databatch.dtd">"
from data.xml everything works, and the contentents of data.xml are loaded into the table.
Any idea what I'm missing here? Likely the problem is with special characters.
Thanks in advance,I'm able to load your file just by removing the second line <!DOCTYPE databatch SYSTEM "databatch.dtd">. I dont have your dtd file, so skipped that line. Can you check if it's problem with ur DTD?
-
Help needed to load different xml playlists by clicking button
Hi there,
I have a series of buttons, when i double click a button i want to load a new xml file
I have some functioning code, but when i click on more than one button per run of the application, it will only use the first xml that was clicked / loaded.
Does anyone have any suggestions I would be really grateful
Thanks!
// Music player populated via XML formatted data with associated .mp3 audio files
// songs to play structured as an XMLList class
// displays artist and song title in the interface
cover.visible = false;
cover2.visible = false;
// song list base on an XMLList class
var songList:XMLList;
// total number of songs in list
var songsTotal:Number;
// sound class variable
var sound:Sound;
// sound channnel variable to play, pause and stop the sound
var soundChannel:SoundChannel;
// holds a reference to the current song playing
var currentSong:Number = 0;
// variable to store the song position when paused
var songPosition:Number;
// flag to check if current song is paused
var songPaused:Boolean;
// loader for XML via a URL
var XMLLoader:URLLoader = new URLLoader();
// various buttons to control songs via the interface
next_btn.addEventListener(MouseEvent.CLICK, onNext);
prev_btn.addEventListener(MouseEvent.CLICK, onPrev);
pause_btn.addEventListener(MouseEvent.CLICK, onPause);
play_btn.addEventListener(MouseEvent.CLICK, onPlay);
album1.doubleClickEnabled=true;
album2.doubleClickEnabled=true;
album1.addEventListener(MouseEvent.DOUBLE_CLICK, loadalbum1);
album2.addEventListener(MouseEvent.DOUBLE_CLICK, loadalbum2);
// check the data has loaded correctly
XMLLoader.addEventListener(Event.COMPLETE, processXML);
// this function processes the XML data
function processXML(e:Event):void {
// create an XML playlist structure
var anXMLplayList:XML = new XML(e.target.data);
// associate the playlist songs with the internal song list
songList = anXMLplayList.SONG;
// set the total songs to those found in the XML data
songsTotal = songList.length();
// remove the eventlistener and restore variables
XMLLoader.removeEventListener(Event.COMPLETE, processXML);
XMLLoader = null;
// this function starts the first song in the list
// when the play_btn is pressed via the onPlay function
function playSong(aSong:Number):void {
// variables for the Title, Artist and associated song in the song list
var aTitle = songList[aSong].@TITLE;
var anArtist = songList[aSong].@ARTIST;
var aURL = songList[aSong].@URL;
// populate the interface with the current song data
title_txt.text = aTitle;
artist_txt.text = anArtist;
// check to see if the sound channel is active
if (soundChannel) {
soundChannel.stop();
soundChannel.removeEventListener(Event.SOUND_COMPLETE, onNext);
// create a new sound object
sound = new Sound();
// load the sound from the URL song data
sound.load(new URLRequest(aURL));
// activate the sound channel via the play method
soundChannel = sound.play();
// when the current songh completes - play the next song via the onNext function
soundChannel.addEventListener(Event.SOUND_COMPLETE, onNext);
// this function plays the next song in the list
function onNext(e:Event):void {
// increment the current song
currentSong++;
// reset the current song if no more to play
if (currentSong>=songsTotal) {
currentSong=0;
// else play the current song via the playSong method
playSong(currentSong);
// this function plays the previous song in the song list
function onPrev(e:MouseEvent):void {
currentSong--;
if (currentSong<0) {
currentSong = songsTotal-1;
playSong(currentSong);
// this function pauses the current song playing and sets the boolean flag
// accordingly
function onPause(e:MouseEvent):void {
if (soundChannel) {
songPosition = soundChannel.position;
soundChannel.stop();
songPaused=true;
// this function plays the current song or restarts a paused song
function onPlay(e:MouseEvent):void {
if (songPaused) {
soundChannel = sound.play(songPosition);
songPaused=false;
} else if (!soundChannel) {
playSong(currentSong);
function loadalbum1(e:Event):void {
cover.visible = true;
cover2.visible = false;
// load the XML formated playlist
XMLLoader.load(new URLRequest("playlist1.xml"));
function loadalbum2(e:Event):void {
cover2.visible = true;
cover.visible = false;
// load the XML formated playlist
XMLLoader.load(new URLRequest("playlist2.xml"));You should try to limit the code you post to what is relevant to the problem... it is hard to track things down, especially when your code is not formatted properly with indentations.
I didn't search farther than finding that you remove the event listener for the URLLoader...
XMLLoader.removeEventListener(Event.COMPLETE, processXML);
so if you remove it after you load the first file and do not restore one for it, then chances are you don't "processXML" any more than the first file you load -
Loading new xml data into a already xml populated image display
Hi everybody,
I have a question about loading new xml data into a already xml populated image gallery.
So I have my gallery set up so it calls some xml when it first loads. What I would now like to do is load different sets of images via a different xml sheet via the click of a button.
So for example the loaded gallery already has all thumbs loaded and user can click on them to view the full size image. So next instead of the user having to close this gallery to allow a new gallery to open with a different set of pictures I would just like to have a button. This button will unload the existing thumbs from the gallery and load in new ones from a different xml file.
If anybody can help me with this it would be great as I am still on a steep learning curve with AS3.
Here is my AS3
var xmlPath:String = "pictures.xml";
var xml:XML;
var loader = new URLLoader();
loader.load(new URLRequest(xmlPath));
loader.addEventListener(Event.COMPLETE, xmlLoaded);
function xmlLoaded(e:Event):void
if ((e.target as URLLoader) != null )
xml = new XML(loader.data);
createMenu();
var numberOfItems:uint = 0;
var menuItems:Array = new Array();
function createMenu():void
numberOfItems = xml.items.item.length();
var count:uint = 0;
for each (var item:XML in xml.items.item)
var imageLoader=new Loader();
var menuItem:MenuItem = new MenuItem();
menuItem.addChild(imageLoader);
imageLoader.load(new URLRequest(item.url));
menuItem.linkTo = item.linkTo;
menuItem.mouseChildren = false;
menuItem.addEventListener(MouseEvent.CLICK, itemClicked);
menuItems.push(menuItem);
addChild(menuItem);
count++;
function ***():void
//menuItems.sortOn("zpos3D", Array.NUMERIC | Array.DESCENDING);
for (var i:uint = 0; i < menuItems.length; i++)
setChildIndex(menuItems[i], i);Thanks so much for the reply Andrei1
I think maybe my lack of knowledge when it comes to AS3 is not helping me at the moment because I thought I understood the code you supplied but there is something not going quite right.
So I messed around with the code and added the new_loaded_thumbs_btn to load in the "new_pictures.xml" but I am def doing something wrong.
import flash.ui.ContextMenuItem;
var xmlPath:String = "pictures.xml";
var xml:XML;
var numberOfItems:uint = 0;
var menuItems:Array = new Array();
var loader = new URLLoader();
loader.addEventListener(Event.COMPLETE, xmlLoaded);
loadXML("pictures.xml");
new_loaded_thumbs_btn.addEventListener(MouseEvent.CLICK, loadXML);
function loadXML(path:String):void {
loader.load(new URLRequest("new_pictures.xml"));
function loadXML(path:String):void {
loader.load(new URLRequest(path));
function xmlLoaded(e:Event):void
xml = new XML(loader.data);
createMenu();
function createMenu():void
clearMenu();
numberOfItems = xml.items.item.length();
var count:uint = 0;
var imageLoader;
var menuItem:MenuItem;
for each (var item:XML in xml.items.item)
imageLoader = Loader();
menuItem = new MenuItem();
menuItem.addChild(imageLoader);
imageLoader.load(new URLRequest(item.url));
menuItem.linkTo = item.linkTo;
menuItem.mouseChildren = false;
menuItem.addEventListener(MouseEvent.CLICK, itemClicked);
menuItems.push(menuItem);
addChild(menuItem);
count++;
sortChildren();
// removes previously placed objects
function clearMenu():void {
var menuItem:MenuItem;
while (menuItems.length > 0) {
menuItem = menuItems[0];
removeChildAt(getChildIndex(menuItem));
menuItem.shift();
function sortChildren():void
//menuItems.sortOn("zpos3D", Array.NUMERIC | Array.DESCENDING);
for (var i:uint = 0; i < menuItems.length; i++)
setChildIndex(menuItems[i], i);
When the image display 1st loads it displays the new_pictures.xml thumbs which I thought would load through my new button when clicked.
And there was me thinking I was getting the hang of AS3.
Could you please point me in the right direction in what I am doing wrong,
Thanks for your time and effort in advance -
Hi,
I have a webpage created in flash which uses xml to load specific gallerys into movie clips. Everything works fine in preview, but when uploaded it doesn't work. When you click on film or any of the other galleries, the galley does not load. I don't know whether this has something to do with the hosting or not. I'm only begining to use xml so my knowledge is quite limited. Any help would be much appreciated. The website adress is below. I've also attached my action script. Cheers
http://www.honeytree.com.au/luke/walshwebsite/
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
thumbnails = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
thumbnails[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
thumbnails_fn(i);
firstImage();
} else {
content = "file not loaded!";
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("film.xml");
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
Key.addListener(listen);
previous_btn.onRelease = function() {
prevImage();
next_btn.onRelease = function() {
nextImage();
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
picture_num();
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
function thumbNailScroller() {
// thumbnail code!
this.createEmptyMovieClip("tscroller", 1000);
scroll_speed = 20;
tscroller.onEnterFrame = function() {
if ((_root._ymouse>=thumbnail_mc._y) && (_root._ymouse<=thumbnail_mc._y+thumbnail_mc._height)) {
if ((_root._xmouse>=(hit_right._x-40)) && (thumbnail_mc.hitTest(hit_right))) {
thumbnail_mc._x -= scroll_speed;
} else if ((_root._xmouse<=40) && (thumbnail_mc.hitTest(hit_left))) {
thumbnail_mc._x += scroll_speed;
} else {
delete tscroller.onEnterFrame;
function thumbnails_fn(k) {
thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc._x = hit_left._x+(eval("thumbnail_mc.t"+k)._width+5)*k;
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = this.pictureValue-1;
nextImage();
target_mc.onRollOver = function() {
this._alpha = 50;
thumbNailScroller();
target_mc.onRollOut = function() {
this._alpha = 100;
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);Your xml file appears to be specifying local drive paths rather than web paths...
\film\DSC_0040web.jpg
should be
film/DSC_0040web.jpg -
XML grid gallery not loading full images(except for one)
hi,
I just created my first flash website, but one of my XML image galleries is not working properly. I am using the same (code, layout, just different pics and xml files) gallery on 4 of my pages, however, one("products") of the 4 will not load the "full" images. The thumbnails load, they decrease opacity when moused over, but once you click on one, the progress bar loads till complete and just stops. You can see the problem in action atwww.erikhigbee.com on the "Products" page. This problem, however, only occurred after I hosted it on iPage.com. When I test it (Ctrl+Enter) in Flash, test it in Dreamweaver or open the .html of it from my computer, everything works perfectly. It is only after I FTP upload all the files to iPage's server that this problem occurs. I made sure to keep the filetree the same and everything. Is it a problem with Ipage? Are too many images trying to load??
Furthermore, for some odd reason the 1st image(left), 4th row down on the s"Products" page DOES load the full image but the others still dont and I can't for the life of me figure out why. All the code is exactly the same as on the other pages.
Thanks for any and all help/advice you can give me!
one thought(from posts on other forums) could be inefficient code. Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed. pops up whenever the thumbs are clicked. idk if that helps.
below is the code i used for the gallery. Could anyone take a quick look over it and see if any problems/inefficiencies jump out at ya??
[CODE]import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.display.MovieClip;
import flash.display.Loader;
import flash.events.MouseEvent;
import fl.controls.ProgressBar;
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
var columns:Number;
var my_x:Number;
var my_y:Number;
var my_thumb_width:Number;
var my_thumb_height:Number;
var my_images:XMLList;
var my_total:Number;
var container_mc:MovieClip;
var preloaders_mc:MovieClip;
var full_mc:MovieClip;
var x_counter:Number = 0;
var y_counter:Number = 0;
var my_tweens:Array = [];
var container_mc_tween:Tween;
var full_tween:Tween;
var myXMLLoader:URLLoader = new URLLoader();
myXMLLoader.load(new URLRequest("gallery_hats.xml"));
myXMLLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(e:Event):void{
var myXML:XML = new XML(e.target.data);
columns = myXML.@COLUMNS;
my_x = myXML.@XPOSITION;
my_y = myXML.@YPOSITION;
my_thumb_width = myXML.@WIDTH;
my_thumb_height = myXML.@HEIGHT;
my_images = myXML.IMAGE;
my_total = my_images.length();
createContainer();
callThumbs();
myXMLLoader.removeEventListener(Event.COMPLETE, processXML);
myXMLLoader = null;
function createContainer():void{
container_mc = new MovieClip();
container_mc.x = my_x;
container_mc.y = my_y;
addChild(container_mc);
container_mc.addEventListener(MouseEvent.CLICK, callFull);
container_mc.addEventListener(MouseEvent.MOUSE_OVER, onOver);
container_mc.addEventListener(MouseEvent.MOUSE_OUT, onOut);
container_mc.buttonMode = true;
preloaders_mc = new MovieClip();
preloaders_mc.x = container_mc.x;
preloaders_mc.y = container_mc.y;
addChild(preloaders_mc);
function callThumbs():void{
for (var i:Number = 0; i < my_total; i++){
var thumb_url = my_images[i].@THUMB;;
var thumb_loader = new Loader();
thumb_loader.load(new URLRequest(thumb_url));
thumb_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbLoaded);
thumb_loader.name = i;
thumb_loader.x = (my_thumb_width+10)*x_counter;
thumb_loader.y = (my_thumb_height+10)*y_counter;
if (x_counter+1 < columns){
x_counter++;
} else {
x_counter = 0;
y_counter++;
var preloader_pb:ProgressBar = new ProgressBar();
preloader_pb.source = thumb_loader.contentLoaderInfo;
preloader_pb.x = thumb_loader.x;
preloader_pb.y = thumb_loader.y;
preloader_pb.width = my_thumb_width;
preloader_pb.height = my_thumb_height/10;
preloaders_mc.addChild(preloader_pb);
preloader_pb.addEventListener(Event.COMPLETE, donePb);
function thumbLoaded(e:Event):void{
var my_thumb:Loader = Loader(e.target.loader);
container_mc.addChild(my_thumb);
my_tweens[Number(my_thumb.name)]=new Tween(my_thumb, "alpha", Strong.easeIn, 0,1,0.5, true);
my_thumb.contentLoaderInfo.removeEventListener(Event.COMPLETE, thumbLoaded);
function callFull(e:MouseEvent):void{
var full_loader = new Loader();
var full_url = my_images[e.target.name].@FULL;
full_loader.load(new URLRequest(full_url));
full_loader.contentLoaderInfo.addEventListener(Event.INIT, fullLoaded);
var full_pb:ProgressBar = new ProgressBar();
full_pb.source = full_loader.contentLoaderInfo;
full_pb.x = (stage.stageWidth - full_pb.width)/2;
full_pb.y = (stage.stageHeight - full_pb.height)/2;
preloaders_mc.addChild(full_pb);
full_pb.addEventListener(Event.COMPLETE, donePb);
container_mc.removeEventListener(MouseEvent.CLICK, callFull);
container_mc.buttonMode = false;
container_mc.removeEventListener(MouseEvent.MOUSE_OVER, onOver);
container_mc.removeEventListener(MouseEvent.MOUSE_OUT, onOut);
container_mc_tween = new Tween(container_mc, "alpha", Strong.easeIn, 1,0.5,0.5, true);
function fullLoaded(e:Event):void{
full_mc = new MovieClip();
full_mc.buttonMode = true;
addChild(full_mc);
var my_loader:Loader = Loader(e.target.loader);
full_mc.addChild(my_loader);
full_tween = new Tween(my_loader, "alpha", Strong.easeIn, 0,1,0.5, true);
my_loader.x = (stage.stageWidth - my_loader.width)/2;
my_loader.y = (stage.stageHeight - my_loader.height)/2;
my_loader.addEventListener(MouseEvent.CLICK, removeFull);
my_loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, fullLoaded);
function removeFull(e:MouseEvent):void{
var my_loader:Loader = Loader (e.currentTarget);
full_tween = new Tween(my_loader, "alpha", Strong.easeOut, 1,0,0.5, true);
full_tween.addEventListener(TweenEvent.MOTION_FINISH, tweenFinished);
container_mc_tween = new Tween(container_mc, "alpha", Strong.easeOut, 0.5,1,0.5, true);
function donePb(e:Event):void{
var my_pb:ProgressBar = ProgressBar(e.target);
preloaders_mc.removeChild(my_pb);
my_pb.removeEventListener(Event.COMPLETE, donePb);
function tweenFinished(e:TweenEvent):void{
var my_loader:Loader = Loader (e.target.obj);
my_loader.unload();
full_mc.removeChild(my_loader);
removeChild(full_mc);
full_mc = null;
container_mc.addEventListener(MouseEvent.CLICK, callFull);
container_mc.buttonMode = true;
container_mc.addEventListener(MouseEvent.MOUSE_OVER, onOver);
container_mc.addEventListener(MouseEvent.MOUSE_OUT, onOut);
var my_tween:Tween = Tween(e.target);
my_tween.removeEventListener(TweenEvent.MOTION_FINISH, tweenFinished);
function onOver(e:MouseEvent):void{
var my_thumb:Loader = Loader(e.target);
my_thumb.alpha = 0.5;
function onOut(e:MouseEvent):void{
var my_thumb:Loader = Loader(e.target);
my_thumb.alpha = 1;
[/CODE]Hi,
at www.lynda.com there is a great video tutorial.
Search for Create and Embed a Photo Gallery in a PDF -
Firefox flash plugin not loading external xml file?
I have a Flash based website that uses an external xml file
to load the interface and navigation. When I view the site in
Firefox it never seems to load the xml file therefore the interface
doesn't load.
Any ideas?Hi,
I have followed your instructions and could able to get it working for firefox. The sameway i tried with mozilla, but not working. This time, I didnt see any errors but it is not working as expected (no animations / images displayed)
So could you please help me.
My system config. is X86 Solaris 5.10.
bash-3.00# pwd
/usr/sfw/lib/mozilla/plugins
bash-3.00# elfdump -e libflashplayer.so
ELF Header
ei_magic: { 0x7f, E, L, F }
ei_class: ELFCLASS32 ei_data: ELFDATA2LSB
e_machine: EM_386 e_version: EV_CURRENT
e_type: ET_DYN
e_flags: 0
e_entry: 0x94 e_ehsize: 52 e_shstrndx: 37
e_shoff: 0x7fb4ac e_shentsize: 40 e_shnum: 39
e_phoff: 0x34 e_phentsize: 32 e_phnum: 3Thanks
Ram. -
I am making a gallery using xml and as3. I've run into a
problem very early and I'm not too good with Actionscript yet. So
I've come here for some help.
What I want right now, is to have an image be loaded from a
xml file, which is working for me. And then have a white movieclip
come in a resize behind the image to be a frame for the image. I
haven't gotten to this part yet. My problem starts when I try to
load the image with a blank movieclip to position it. The image
loads, but the eventListener won't run the imageLoaded function. If
I remove the function and just have
holder_mc.addchild(imageLoader); Then it works, but I need the
image to load and then resize the movieclip frame, and then display
both right? How can I accomplish this?I was trying to solve this myself just last night and after
seeing your post today I figured maybe I can help you out (as long
as I'm addressing the problem you have).
apparently the addEventListener needs a kick start from
something else. If you look up the Loader class in the Flash help
files it provides an example near the bottom that holds the key.
I'm providing a shorthanded solution that I derived from it.
Rather than:
imageLoader.addEventListener(Event.COMPLETE,
completeHandler);
There is another piece in the in the middle of the process:
"contentLoaderInfo"
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
completeHandler);
Hope that helps -
Sending variable value from php to flash to load an xml file
I would like to load an XML file from the location locally or on the server being unaware of the name of the file. I am using PHP for sending the filename to Flash.
The below is the PHP code:
<?php
filesInDir('C:\Documents and Settings\457305\My Documents\shrikant\Flash Tutorials\webassist');
function filesInDir($tdir)
$dirs = scandir($tdir);
foreach($dirs as $file)
if (($file == '.')||($file == '..'))
elseif (is_dir($tdir.'/'.$file))
filesInDir($tdir.'/'.$file);
else
echo "fileName=$file";
?>
And below is the loading Actionscript code:
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.net.URLVariables;
stop();
// Define the PHP file to be loaded
var phpFile:String = "http://localhost/webassist/test.php";
var cons_xml:XML;
var xmlLoader:URLLoader = new URLLoader();
// Specify dataFormat property of the URLLoader to be "VARIABLES"
// This ensures variables loaded into Flash with same variable names
xmlLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
xmlLoader.load(new URLRequest(phpFile));
xmlLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(evt:Event):void
trace(evt.target.data.fileName);
//cons_xml = new XML(evt.target.data.fileName);
//gotoAndPlay(2);
When I trace the evt.target.data it displays "fileName=mainOpenEndedXML%2Exml" and when I trace evt.target.data.fileName the fileName is properly displayed as "mainOpenEndedXML.xml".
But in the next two lines where the loading occurs it does not load the file i.e the swf file from xml doesn't play.
I have been searching the Internet for answers but not able to find any solutions.
The loading works properly if i directly insert the xml file in the code and the swf's in the XML file play propertly. The below is the code for the same:
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.net.URLVariables;
stop();
var cons_xml:XML;
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.load(new URLRequest("mainOpenEndedXML.xml"));
xmlLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(evt:Event):void
cons_xml = new XML(evt.target.data);
gotoAndPlay(2);
Any help on this would be greatly appreciatedYes. you already said that, but I guess you don't understand what I said. You are loading the PHP fle to get the filename, but nowhere are you taking that filename and loading the file that was named.
You need to do two loading operations. The first one to get the filename, and the second to load the file with that name. Maybe if you name the PHP file loader phpLoader instead of xmlLoader it will start to make more sense to you. Something like the following...
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.net.URLVariables;
stop();
// Define the PHP file to be loaded
var phpFile:String = "http://localhost/webassist/test.php";
var phpLoader:URLLoader = new URLLoader();
// Specify dataFormat property of the URLLoader to be "VARIABLES"
// This ensures variables loaded into Flash with same variable names
phpLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
phpLoader.load(new URLRequest(phpFile));
phpLoader.addEventListener(Event.COMPLETE, processPHP);
function processPHP(evt:Event):void
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.load(new URLRequest(String(evt.target.data.fileName)));
xmlLoader.addEventListener(Event.COMPLETE, processXML);
var cons_xml:XML;
function processXML(evt:Event):void
cons_xml = new XML(evt.target.data);
gotoAndPlay(2); -
Small Bug in Flash 8: loading swf that´s a vectorized image in many layers
Hi! There´s a small bug in flash 8. If you load a swf
that it´s a vectorized image in many layers, when you give it
an action in onLoadInit, like mc.onRelease, the mc don´t
"catch" that action. You can try loading an image (it works), a lot
of swf (it works), but with this kind of swf the actions onRelease,
onPress, etc... don´t work.
The
swf
I´ll make a different vectorized image to make it works
(if there is only one layer it works)Seems odd it will only run once. Usually if a cache problem
you get the same
results even when you update the movie or server scripts.
If it is
http:// it is not local even if from the browser
cache.
Verify the html is validated.
Check to see if this applies to all swfs. Create a simple
hello world swf
that connects to a JSP script that returns a simple value to
Flash. If that
seems to work, then the problem is in the JSP or
Actionscripting coding.
Check you can load the JSP script repeatedly using a direct
call to it on
the browser line using
http://.
Lon Hosford
www.lonhosford.com
Flash, Actionscript and Flash Media Server examples:
http://flashexamples.hosfordusa.com
May many happy bits flow your way!
"srikanth_s_india" <[email protected]> wrote
in message
news:e6obld$lfb$[email protected]..
> Thanks for the article link.
>
> I can't provide the URL as it is within our application
which requires
> logging
> in. However, one more interesting thing about it is that
it always works
> for
> the first time (in the browser/machine) but not from the
next time.
>
> My doubt is whether it is because of the caching? When
it loads for the
> first
> time, the HTML and SWF files load from our server and
hence are allowed to
> communicate with our JSP. However, when it loads the
subsequent times, it
> probably loads from the cache and hence considered as a
local file and not
> allowed to communicate with our JSP file which is on the
Internet.
>
> Can anybody tell me how to enable a local SWF file to
load SWF files from
> the
> Internet & access URLs from the Internet in Flash 8
pluggin?
> -
I have a movie on my stage that will need to load in a
relatively small xml document. The problem is that the xml that is
loaded into the flash is based on search results so it will change
all the time and therefore won't read from a local xml file. I have
an example working where it calls a webservice to do the search and
gets back the xml. But in this scenerio the flash has to load, run
the search and then parse the results so it could be a few seconds
that the page has loaded before the flash finishes loading. I've
thought about passing the xml in as a parameter which would put it
right in the html code. I'm not sure how to do this though in as3.
Is there another way that I'm overlooking where it could load the
xml without having to put it right in the html or call a
webservice? Thanks.I am at work now and able to access my files. I have
developed this basic xml loader class. Some of it is my creation,
some of it I pulled from these forums. Hope it helps you out. -
Pre-loading images loaded from XML.
Hello,
I hoping for some guidance please.
I have a Gallery that loads thumbnails from an XML.
I have added a pre-loader to each one of the thumbnails as it is being loaded from the XML.
My problem is that I can't figure out how to remove the pre-loaders after it has called the Event.COMPLETE.
With my curent code,
As it completes loading the thumbnails, it throws an error and only removes the very last pre-loader.
Thanks for any help you can provide.
Here is the code I am currently using.
var urlRequest:URLRequest = new URLRequest("images.xml");
var urlLoader:URLLoader = new URLLoader();
var myXML:XML = new XML();
var xmlList:XMLList;
urlLoader.load(urlRequest);
myXML.ignoreWhitespace = true;
urlLoader.addEventListener(Event.COMPLETE,fileLoaded);
var arrayURL:Array = new Array();
var arrayName:Array = new Array();
var holderArray:Array = new Array();
var nrColumns:uint = 1;
var wheel:MovieClip;
var holdMe;
var thumbsprite:Sprite = new Sprite();
addChild(thumbsprite);
var thumb:Thumbnail;
var thumbsHolder:Sprite = new Sprite();
thumbsprite.addChild(thumbsHolder);
function fileLoaded(event:Event):void {
myXML = XML(event.target.data);
xmlList = myXML.children();
for (var i=0; i<xmlList.length(); i++) {
var picURL:String = xmlList[i].url;
var picName:String = xmlList[i].big_url;
arrayURL.push(picURL);
arrayName.push(picName);
holderArray[i] = new Thumbnail(arrayURL[i],i,arrayName[i]);
holdMe = holderArray[i];
var loader:Loader = new Loader();
loader.load(new URLRequest(xmlList[i].url));
wheel=new rootz();
holdMe.addChild(wheel);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, preload);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completed);
function preload(event:ProgressEvent):void {
var percent:Number = Math.round(event.bytesLoaded / event.bytesTotal * 100);
trace(String(percent) + "%");
function completed(event:Event):void {
holdMe.removeChild(wheel);
if (i<nrColumns) {
holderArray[i].y = 65;
holderArray[i].x = i*100;
} else {
holderArray[i].y = holderArray[i-nrColumns].y+110;
holderArray[i].x = holderArray[i-nrColumns].x;
thumbsHolder.addChild(holderArray[i]);I am not sure why but the code I posted did not post right,
Here is my code -
var urlRequest:URLRequest = new URLRequest("images.xml");
var urlLoader:URLLoader = new URLLoader();
var myXML:XML = new XML();
var xmlList:XMLList;
urlLoader.load(urlRequest);
myXML.ignoreWhitespace = true;
urlLoader.addEventListener(Event.COMPLETE,fileLoaded);
var arrayURL:Array = new Array();
var arrayName:Array = new Array();
var holderArray:Array = new Array();
var nrColumns:uint = 1;
var wheel:MovieClip;
var holdMe;
var thumbsprite:Sprite = new Sprite();
addChild(thumbsprite);
var thumb:Thumbnail;
var thumbsHolder:Sprite = new Sprite();
thumbsprite.addChild(thumbsHolder);
function fileLoaded(event:Event):void {
myXML = XML(event.target.data);
xmlList = myXML.children();
for (var i=0; i<xmlList.length(); i++) {
var picURL:String = xmlList[i].url;
var picName:String = xmlList[i].big_url;
arrayURL.push(picURL);
arrayName.push(picName);
holderArray[i] = new Thumbnail(arrayURL[i],i,arrayName[i]);
holdMe = holderArray[i];
var loader:Loader = new Loader();
loader.load(new URLRequest(xmlList[i].url));
wheel=new rootz();
holdMe.addChild(wheel);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, preload);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completed);
function preload(event:ProgressEvent):void {
var percent:Number = Math.round(event.bytesLoaded / event.bytesTotal * 100);
trace(String(percent) + "%");
function completed(event:Event):void {
holdMe.removeChild(wheel);
if (i<nrColumns) {
holderArray[i].y = 65;
holderArray[i].x = i*100;
} else {
holderArray[i].y = holderArray[i-nrColumns].y+110;
holderArray[i].x = holderArray[i-nrColumns].x;
thumbsHolder.addChild(holderArray[i]); -
Safari won't load XML file - Flash
I know this is in the wrong forum, so if someone can move it, thanks!
The Safari section is down, error loading page.
Here's my problem.
Got a website that is full flash, and some flash that is used on a html based page.
It's a counter, that counts down to a specific date. And these dates are stored in an xml file.
Safari has for some reason massive trouble loading the XML file, and therefore undefines the fields all the time. Occasionally it works, but more often than not it just says 'Undefined'. It works perfectly in IE, and in FF.
In Flash, the XML file is loaded, and its parsed correctly, the actionscript is spot on. So I can't figure the problem.
It's happening on Multiple mac's, and occasionally on Safari for Windows.
www.gpseries.net/forum
Thanks in advance.
Ste
Message was edited by: Stephen Rumbelow
Message was edited by: Stephen RumbelowSafari on my computer doesn't seem to have a problem loading it. You may want to try resetting Safari. Go up to the Menu Bar and click on Safari. There's a choice in the drop down menu called "Reset Safari..." Click on it and select the choices you want to make, after that click ok.
-
Can I have an image as a back up in case flash doesnt load?
Hi, I was thinking....for all those people that come to my site - is it possible to have a back up image if the flash doesnt load?
The current code is:
<div id="mainBanner">
<div id="so1351">You will need flash to view this element<script type="text/javascript">
var so1351 = new SWFObject("/media/11695/29042009.swf", "flash", "994", "224", "8", "#FFFFFF");
so1351.write("so1351");
</script></div>
</div>
Anyone know? All comments very appreciated!wow - thanks for your advice.
Would that be simple code like <img src="/image.jpg">?
Really? Wouldnt that overide the flash or doesnt it work like? I guess I need to try and see first.....
thanks again, any additional comments would be very gratefully received. -
Load variables from XML into Flash
I was wondering how to load variables from an XML document to
a Flash file? I am familiar with the code to do it for a text file,
but was wondering how to do it for XML.
Many thanks in advance!
JJThanks for the recommendation on the site. What I am trying
to do is load varaibles from an XML file into text boxes in my
flash movie.
Here is my loading:
var my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.onLoad = function(success){
if (success) {
gotoAndStop("slide01");
my_xml.load("narration.xml");
this is what I have on my frame with the text boxes (the text
boxes are also have the variable name in the variable area)
var narration = my_xml.picture01;
var my_title = my_xml.my_title;
var my_date = my_xml.my_date;
should I do my_date.text = my_xml.my_date; instead?
my xml doc looks like this
<?xml version="1.0" encoding="iso-8859-1"?>
<picture01>This is the text for picture
01</picture01>
<picture02>This is the text for picture
02</picture02>
<my_title>Las Vegas</my_title>
<my_date>October</my_date>
Any help on this would be GREATLY appreciated!
Text
my_date.text = my_xml.my_date;
Maybe you are looking for
-
PDF Portfolio Layouts - How?
I have Acrobat 9.0.0 and I'm trying to create a PDF Portfolio, but I am unable to change the layout. Every internet search I have found, shows the Layout toolbar automatically appearing, but I don't have that toolbar. I don't if my version doesn't al
-
Dear SAP Gurus, In the Tax calculation procedure TAXINJ we maintain the Condition Types (JES4 Say!) We then define the TAX Codes with the calcutaion Tax Condtion type has Access MWST ( Country /Tax Code) Now in the SD We define the same condtion type
-
Get value of Table data in Event of Table maintaince generaor
Hi Expert, I want content of table in event of table maintenance generator (Event 01 - Before Saving Data in Database). can you please tell me that how can i achieve this value of whole table in this event. Regards, Chintan Shah
-
Every time I click on a video it sends an error message.
I get emails with video's I like to watch. I recently changed my tower and thought I updated everything but every time I click on a video to watch, I get a blue screen with wording on it about error messages. I can't remember exactly what it says but
-
Execute script from Flash Widget
Hello everyone, I'm on a panel, and I just wanna know: is it possible to execute a script from a flash widget, and how? I was thinking of Flash' "getURL()" function, without any success. The idea is that I want to make some sort of form in flash (sin