Loading Single Image Via XML
Hey guys, I am trying to load a single image on to the stage via an xml file.
Here is my xml file
<?xml version="1.0" encoding="utf-8"?>
<pictures>
<pic>image1.jpg</pic>
</pictures>
I'm trying to figure out the actionscript 3 code but I don't know how to code it.
If someone can please point me to the code or tutorial, it would be much appreciated.
You would load the xml by doing this:
var req:URLRequest = new URLRequest("xmlfilename.xml");
var ldr:URLLoader = new URLLoader();
ldr.addEventListener(Event.COMPLETE,xmlLoaded);
ldr.load(req);
function xmlLoaded(e:Event){
var xml:XML = XML(e.target.data);
//see * below..
* then the code to load the image could go in the xmlLoaded function (in place of that //see below line), and would look like this:
var imgreq:URLRequest = new URLRequest(xml.pictures.pic[0]);
var imgldr:Loader = new Loader();
imgldr.load(imgreq);
addChild(imgldr);
Normally you might add a listener to the Loader's contentLoaderInfo, so that you could then size or position the image before adding it to the stage. But hopefully the above code would get you as far as having the image in the top left of the stage.
Read up more on Loader, URLRequest, URLLoader, and XML, to get a sense of the various parts of the whole process.
Similar Messages
-
How to load external png image via xml?
Can anyone help me with adding a png image to a mc with an instance name.
I only want to display a single image (no gallery)
I would like to get the url for the image via an xml.
Here is a copy of my current action script which has already pulled in the xml data which includes the node with the url for the photo.
import flash.events.Event;
import flash.events.MouseEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;
var myXML:XML;
var myLoader:URLLoader = new URLLoader();
myLoader.load(new URLRequest("links.xml"));
myLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(e:Event):void
myXML = new XML(e.target.data);
trace(myXML);
menumv.carbtn.addEventListener(MouseEvent.CLICK, openCURL);
menumv.edubtn.addEventListener(MouseEvent.CLICK, openEURL);
menumv.psybtn.addEventListener(MouseEvent.CLICK, openPURL);
menumv.stubtn.addEventListener(MouseEvent.CLICK, openSTURL);
menumv.busbtn.addEventListener(MouseEvent.CLICK, openBURL);
menumv.shabtn.addEventListener(MouseEvent.CLICK, openSURL);
studentmv.stuname.text = myXML.student.name;
function openCURL(e:MouseEvent):void
navigateToURL(new URLRequest(myXML.car.url));
function openEURL(e:MouseEvent):void
navigateToURL(new URLRequest(myXML.edu.url));
function openPURL(e:MouseEvent):void
navigateToURL(new URLRequest(myXML.psy.url));
function openSTURL(e:MouseEvent):void
navigateToURL(new URLRequest(myXML.stu.url));
function openBURL(e:MouseEvent):void
navigateToURL(new URLRequest(myXML.bus.url));
function openSURL(e:MouseEvent):void
navigateToURL(new URLRequest(myXML.sha.url));
And here is a copy of the node containing the url
<menu>
<student>
<name>testnamehere</name>
<photo>http://10.0.0.2/test/photos/testnamephoto.jpg</photo>
</student>
</menu>
I did see this tutorial but it was for a gallery and I couldnt seem to hack and slash it to do what I want.
http://tuts.flashmint.com/creating-a-simple-xml-gallery-in-actionscript3/
Thanks again in advance for all the help.I have added that code but I think i have buggered up something else in the process.
I get the following error
ReferenceError: Error #1069: Property data not found on flash.display.LoaderInfo and there is no default value.
at sdp_fla::MainTimeline/load_complete()
Current AS
import flash.events.Event;
import flash.events.MouseEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;
var myXML:XML;
var myLoader:URLLoader = new URLLoader();
myLoader.load(new URLRequest("links.xml"));
myLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(e:Event):void
myXML = new XML(e.target.data);
trace(myXML);
menumv.carbtn.addEventListener(MouseEvent.CLICK, openCURL);
menumv.edubtn.addEventListener(MouseEvent.CLICK, openEURL);
menumv.psybtn.addEventListener(MouseEvent.CLICK, openPURL);
menumv.stubtn.addEventListener(MouseEvent.CLICK, openSTURL);
menumv.busbtn.addEventListener(MouseEvent.CLICK, openBURL);
menumv.shabtn.addEventListener(MouseEvent.CLICK, openSURL);
studentmv.stuname.text = myXML.student.name;
var _request:URLRequest = new URLRequest(myXML.student.photo);
var _ldr = new Loader();
studentmv.photo.addChild(_ldr);
_ldr.load(_request);
_ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, load_complete, false, 0, true);
function openCURL(e:MouseEvent):void
navigateToURL(new URLRequest(myXML.car.url));
function openEURL(e:MouseEvent):void
navigateToURL(new URLRequest(myXML.edu.url));
function openPURL(e:MouseEvent):void
navigateToURL(new URLRequest(myXML.psy.url));
function openSTURL(e:MouseEvent):void
navigateToURL(new URLRequest(myXML.stu.url));
function openBURL(e:MouseEvent):void
navigateToURL(new URLRequest(myXML.bus.url));
function openSURL(e:MouseEvent):void
navigateToURL(new URLRequest(myXML.sha.url));
function load_complete(event):void
var bitmap:Bitmap = Bitmap(event.currentTarget.data);
bitmap.smoothing = true;
bitmap.width = studentmv.photo.width
bitmap.width = studentmv.photo.height
studentmv.photo.addChild(bitmap) -
Pre-loading external images for XML-based gallery
I'm working-on an XML-based photo gallery here:
http://www.unionandparkwood.com/demo/flash_gallery/
It works how I want it, except that the first time a
thumbnail is clicked for an image, it pauses long enough to skip
the fade. If you click-through the images a second time, you'll see
that it works smoothly. My guess is that the first time the
thumbnail is clicked, the image isn't cached, yet.
I tried to fix this by creating a JavaScript file for the
page to pre-load each image and thumbnail:
0003a = new Image;
0003a.src = "images/Down-Range.jpg";
0003b = new Image;
0003b.src = "thumbnails/Down-Range.jpg";
But that didn't work. What would be the best way to do this?
I included a link to "Download ZIP" of the FLA project on
this page, too, because it wouldn't be easy for me to describe
what's happening. In a nutshell, a thumbnail click launches a
function that loads the appropriate image into the main image
holder. What seems to be happening the first time is the image
isn't loaded before the fade is finished, so the image just appears
after a short pause the first time.>>What seems to be happening the first time is the
image isn't loaded before
>>the fade is finished, so the image just appears after
a short pause the
>>first time.
As has been said many times in thos forum - use the
MovieClipLoader class to
load images, and then use that class' onLoadInit method to do
things with
the loaded image. Loading is asynchronous - you _have_ to
wait until the
image is done loading before doing a fade.
Dave -
www.offroadfire.com
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/ -
How do i load an image through XML?
Hi.
My code is below. What I am trying is to dinamically load images from xml. I attach the holder from the library, and when i try to target it and addChild to him i get an error:
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest("links.xml"));
var xmlLength:int;
var iconPos:Number = 0;
function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
var xmlLength = xmlData.link.length();
for (var i=0; i<xmlLength; i++) {
var d:MovieClip = new icon();
content_mc.addChild(d);
d.name = "d"+i;
var target:DisplayObject = content_mc.getChildByName("d"+i);
var ldr:Loader = new Loader();
ldr.load(new URLRequest(xmlData.link[i].icon));
target.addChild(ldr);
How can i make this happen and load the image into it's holder?
Thank you.Code from adobe's sample packages cut&&paste&&edit:
AS4 code:
import flash.events.IOErrorEvent;
var fotoElenco:Array;
var fotoXML:XML;
var fotoURLRequest:URLRequest=new URLRequest();
var fotoURLLoader:URLLoader=new URLLoader();
var fotoLoader:Loader=new Loader();
var fotoPosition:Number=0;
var errorMessage:TextField=new TextField();
caricaFoto();
function caricaFoto():void
addChild(errorMessage);
fotoURLRequest.url="gallery.xml";
fotoURLLoader.load(fotoURLRequest);
fotoURLLoader.addEventListener(Event.COMPLETE, showFoto);
fotoURLLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorEventXML);
function ioErrorEventXML(event:IOErrorEvent):void
manageErrorMessage(true, 0);
function manageErrorMessage(val:Boolean, num:Number):void
if(val && num==0){
errorMessage.x=stage.stageWidth/2;
errorMessage.y=stage.stageHeight/2;
errorMessage.text="Errore caricamento file XML";
if(val && num==1){
errorMessage.x=stage.stageWidth/2;
errorMessage.y=stage.stageHeight/2;
errorMessage.text="Errore caricamento file IMMAGINE";
function showFoto(event:Event):void
fwd_mc.buttonMode=true;
back_mc.buttonMode=true;
back_mc.addEventListener(MouseEvent.CLICK, manageFoto);
fwd_mc.addEventListener(MouseEvent.CLICK, manageFoto);
fotoElenco=new Array();
fotoXML=XML(fotoURLLoader.data);
for each(var prop:XML in fotoXML.foto)
fotoElenco.push({url:prop.@url, didascalia:prop.@didascalia});
viewFoto(fotoPosition);
gallery_mc.addChild(fotoLoader);
manageButton();
function manageButton():void
if(fotoPosition<1){
back_mc.visible=false;
}else{
back_mc.visible=true;
if(fotoPosition>=fotoElenco.length-1){
fwd_mc.visible=false;
}else{
fwd_mc.visible=true;
function manageFoto(event:MouseEvent):void
switch(event.currentTarget)
case fwd_mc:
if(fotoPosition<fotoElenco.length-1)
fotoPosition++;
break;
case back_mc:
if(fotoPosition>0)
fotoPosition--;
break;
viewFoto(fotoPosition);
function viewFoto(num:Number):void
fotoLoader.load(new URLRequest(fotoElenco[num].url));
fotoLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorEventIMG);
didascalia_txt.text=fotoElenco[num].didascalia;
manageButton();
function ioErrorEventIMG(event:IOErrorEvent):void
manageErrorMessage(true, 1);
XML code:
<?xml version="1.0" encoding="UTF-8"?>
<gallery>
<foto url="img/immagine1.jpg" didascalia="Didascalia 1 foto"/>
<foto url="img/immagine2.jpg" didascalia="Didascalia 2 foto"/>
<foto url="img/immagine1.jpg" didascalia="Didascalia 1 foto"/>
<foto url="img/immagine2.jpg" didascalia="Didascalia 2 foto"/>
</gallery> -
Help with loading multiple images via LoadVars
Hello everybody.
I need a hand loading multiple images using the LoadVars
method with a text file. I can get it to load 1 image but not
anymore than that. I am aware of other methods like using
components but I am looking for a method where I can access and
change all data from 1 text file (there will be text variable text
within the file aswell to, but I am more concerned with the images
at the moment).
Anyway on to the issue. I have created a much simple .fla
file that outlines my problem.
The movie contains 3 layers:
- top layer contains AS
- middle layer contains an empty movie clip with the
instance name of mcImage1
- bottom layer contains an empy movie clip with the instance
name of mcImage2
The AS layer contains the following code:
imagedata = new LoadVars()
imagedata.load("data.txt")
imagedata.onLoad = function(ok){
if(ok){
mcImage1.loadMovie(this.Image1)
mcImage2.loadMovie(this.Image2)
} else trace("Problem Loading")
In the same folder of my .swf file I have a text file called
data.txt which contains the following
&Image1=image1.gif
&Image2=image2.gif
Also in the same folder of my .swf file I have two images
image1.gif and image2.gif.
When I run the flash the image2.gif is imported correctly.
image1.gif does not appear.
You can download my source files and all images here
http://www.myrealpage.com/projects/var_test/var_test.zip
Any help that can be shed on this problem is much
appreciated.
Thanks
MattGlad to help. It is just that I see so many folks who have
two different parts of a problem smushed together – each
problem isn't so hard on its own, but together they are difficult
to wrap your head around. Always try and break down each step of
the problem and it will help you in the end.
That being said, I'm not quite so sure on this next problem.
I don't do so much timeline stuff along with the Actionscript. I
can get tricky. So this I don't quite have as much of clear mental
picture of what you are describing. But here are some questions
that I would ask – either of myself if I was doing it or of
you.
Is there a stop() on frame one to wait for the
LoadVars.onLoad? Does the onLoad then say to play?
If not, what happens if we get to Frame 10 before the
LoadVars has even finished? That could be a problem.
Remember that the LoadVars object is an actual object that
will exist until it is deleted or removed in various ways. You can
access it at any time after it is loaded. The onLoad event handler
is just that thing you want to happen immediately after it is
loaded.
So my design would probably be.
LoadVars on Frame 1.
Where I am stopped.
In the onLoad handler load the first image and tell the
timeline to play
On frame 10, the LoadVars object will still exist (unless
you've deleted it)
Get the variable out of the LoadVars and load the image.
If you want to check this. Put a stop() in frame 10 and run
it in the testing environment. When it gets to that frame, go to
the debug menu and List Variables. You should see that your
LoadVars object is still there.
Does that answer your question or am I totally missing the
point? -
Images Loaded into Movieclip via XML and Hyperlinked
I am loading a set of images into masked movie clips via an
XML file, and then attemting to hyperlink the Movieclip with a URL
obtained from the XML.
The problem I am having is that the 1st, 3rd, 5th and 7th
clips are not behaving as if they have a hyperlink attached to them
the others are fine.
I'm sure I'm missing something really obvious here, but for
the life of me I can't see it... someone put me out of my misey
please, code is attached, let me know if you want all the files and
I will email them over.
CheersHi kglad,
I traced the length:-
http://www.yahoo.com 20
http://www.google.com 21
http://www.bbc.co.uk 20
http://www.ebay.com 19
http://www.hotmail.com 22
http://www.youtube.com 22
http://www.imdb.com 19
http://www.ask.com 18
so that seems fine.
One point I should make is I tried renaming the movie clips
to see what would happen, so originally mask number one was
hyperlinked to Yahoo and was named 'm0', this link does not work.
Then I renamed mask number 2 as 'm0' and made mask number 1 'm1'.
Even though masks 1 and 2 had effectively swapped position on the
stage, still only links 2,4,6, and 8 work. What I mean is positions
2,4,6 and 8 on screen, not how they are named.
Not sure I've explained myself that clearly there!
Still this is the last thing I need to resolve before I can
move on, so any ideas? -
Load images via xml/parameters, and assign URL
Hi All
I am trying to do a simple gallery that will loop around
three images or so
and when you click on them the page goes to a given URL.
I found a generic example gallery, that reads the image
sources in from an
XML file but it does not have an event attached to it for the
initial click.
The code is this (looping around each node of XML):
imageData = new Object;
imageData.path = imageNode.attributes.path;
imageArray[s]=imageData;
imageNode = imageNode.previousSibling;
I have tried putting:
imageData.href = "
http://www.google.com";
imageData.url = "
http://www.google.com";
But to no avail.
Does anybody have any suggestions or ideas?
Many thanks
Darrencreate arrays that contain the same info as the xml.
p.s. and, you'll use attachMovie() instead of loadMovie(). -
Problem with loading an image via HTTP
Hallo,
When using the JBCL TransparentImage control i can load images
from my local HD. But when i use setImageURL it won't work. I
looked at the sources and it seems to me that the problem lies
within the default toolkit. The following code works when using
a local file. Via HTTP the Observer get's one notification with
just the error-flag set.
URL url=new URL("http://localhost/mxtj_inetmaps/mp_map1.gif");
// String sFileName="c:\\mapinfo\\inetmap\\mp_map1.gif";
Toolkit tk=Toolkit.getDefaultToolkit();
Image i=tk.getImage(url);
// Image i=tk.getImage(sFileName);
MyObserver mo=new MyObserver();
tk.prepareImage(i, -1, -1, mo);
Could someone help me, how to show a Web-Image within a control ?
Bye Heiko.
nullHi,
There is no getImage that accepts the parameters in the order in which you have given them. Try this:
getImage( getCodeBase(), "flower.gif" );
Regards,
Manfred. -
How to have smooth fade effect between the two images via XML
I have my xml gallery working fine, all i need is to have a smooth fade effect between the two images, right now they are changing with a jerk. Can somebody help me getting this effect with my code. Any help is much appreciated.
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
link = [];
thumbnails = [];
thumbnailsOn = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
link[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
thumbnails[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
thumbnailsOn[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
thumbnails_fn(i);
firstImage();
loopPlay();
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("data.xml");
thumbnail_mc.attachMovie("prev", "prev_new", 1);
thumbnail_mc.prev_new._x= -20;
thumbnail_mc.prev_new._y= -1;
thumbnail_mc.attachMovie("next", "next_new", 4);
thumbnail_mc.next_new._y= -1;
//thumbnail_mc.next_new._x= -30;
thumbnail_mc.prev_new.onRelease = function() {
prevImage();
thumbnail_mc.next_new.onRelease = function() {
nextImage();
p = 0;
this.onEnterFrame = function() {
filesize = holder.getBytesTotal();
loaded = holder.getBytesLoaded();
//preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (holder._alpha<100) {
holder._alpha += 10;
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
holder._alpha = 0;
holder.loadMovie(image[p], 1000);
//desc_txt.text = description[p];
picture_num();
click._alpha=0;
click.onRelease = function() {
getURL(link[p], "_blank");
loopStop();
function HoldImage() {
nextImage();
clearInterval(myTimer2);
loopPlay();
function checkImageState() {
if (p==total-1) {
p = -1;
if (loaded==filesize) {
clearInterval(myTimer1);
myTimer2 = setInterval(HoldImage,3000);
function loopPlay() {
myTimer1 = setInterval(checkImageState, 3000);
function loopStop() {
clearInterval(myTimer1);
clearInterval(myTimer2);
function prevImage() {
if (p>0) {
p--;
holder._alpha = 0;
holder.loadMovie(image[p], 1000);
target_mc._alpha = 40;
picture_num();
function firstImage() {
if (loaded == filesize) {
holder._alpha = 0;
holder.loadMovie(image[0], 1000);
picture_num();
function picture_num() {
current_pos = p+1;
function thumbnails_fn(k) {
thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc._x = (target_mc._width+10)*k;
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = this.pictureValue-1;
nextImage();
target_mc.onRollOver = function() {
this._alpha = 40;
target_mc.onRollOut = function() {
this._alpha = 100;
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);I have a center of energy program similar to the one used by IMAQ. I have attached an example using your data. I first found the center of the entire image. Then I split the array in two and found the centers of each half. That gives you the position of the two spots. This program won't work if the spots are too close to each other or are separeted in the other axis.
Attachments:
distance between two spots one direction.vi 1096 KB
Center of energy calc.vi 40 KB -
Hi,
I have two buttons on stage, to load pictures from gallery 1
(gotoAndPlay ("slider1")) and gallery 2 (gotoAndPlay ("slider2"))
respectively. I changed the variable in [quote] _root.xmlfile
[/quote] in the second set (slider2)
mybtn1 loads gallery1 without any problem
mybtn2 loads only one picture from gallery2, nor the text is
loaded.
link
Kindly advise how to get that to work.
Thank youSo what I'm thinking of doing is through the main draw for swf another swf xml attribute.
This loaded swf will be introduced within an attachMovie.
Every time I load a new swf external, will within that attachMovie -
Trouble loading images from XML files using AS
I am creating a slideshow and found a script that will load
the images via an XML document, but I believe the script is for an
absolute references image such as <a href="
http://www.myimages.com/image1.jpg">
and I want to be able to have them in a file and reference the file
in the XML such as :
<pic>
<image>images/04_02.jpg</image>
<caption>Soleil Center 4</caption>
</pic>
When I test movie I get an error
Error opening URL "path_to_image/01_02.jpg"
Is there something I need to change in the AS to be able to
reference a folder on my desktop (in the same directory as .fla
file).
here is the AS code:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image
= xmlNode.childNodes.childNodes[0].firstChild.nodeValue;
description
= xmlNode.childNodes.childNodes[1].firstChild.nodeValue;
firstImage();
} else {
content = "file not loaded!";
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.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;
}something is still amiss here becuase I placed the xml and
images at the root level and the images still do not load. I don't
get any kind of error and Trace tells me the file is being loaded.
took out the /images/ part so that in the XML it's now :
<pic>
<image>07_02.jpg</image>
<caption>Image Description</caption>
</pic>
and here is the AS code:
var image:Array = new Array();
var description:Array = new Array();
function loadXML(loaded) {
if (loaded) {
var xmlNode:XMLNode = this.firstChild;
var total:Number = xmlNode.childNodes.length;
for (var i:Number = 0; i<total; i++) {
image.push(xmlNode.childNodes
.childNodes[0].firstChild.nodeValue);
description.push(xmlNode.childNodes.childNodes[1].firstChild.nodeValue);
trace('File Name Value: '+xmlNode.childNodes);
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.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;
} -
Hi, I am currently having trouble with my swf file inserted in adobe presenter 9. I'm trying to load the sound via XML and it plays on the first frame when it's completed. Now, the sound of SWF is heard on other slides after the SWF slide. It looks like it will going to load again the swf file even when I am not in the swf slide. Anyone could help me with this issue? Thanks.
Thak you for this -- it did help somewhat, but i am still
stuck.
When i use the contentLoaderInfo listener, you are right, i
can discern the width of the loader. but when i do this it only
works for the last item loaded. here is my problem -- i am trying
to load graphics dynamically, and have each graphic go to it's
proper "place" on a simulated shelf -- so the foirst object might
go to (0,0), then next object should go directly to the right of
the first object, etc, etc. and i am loading all this dynamically
from an xml file. if i just specify a distance, then i can get
everything to load at uniform distances from each other. problem is
each of the graphics has a unique width, height, etc, so i need to
be able to "catch and capture" this info as each one is loaded.
when i wait until the entire loader has loaded, the only
peopoerties left for me to capture and use are the propoerties of
the last itm loaded.
any ideas on how to do this -- anyone?
thanks very much, i just can't seem to figure this out. -
Loading multiple images in applet
I am trying to create an applet that displays 8 images in a grid and up until now I have had no problems loading single images into the applet but I am having difficulty more than one. I thought I could just create multiple lines of the getImage method. It keeps telling me that an identifier is expected. I'm quite new to this so don't mock me.
import java.applet.*;
import java.awt.*;
import javax.swing.*;
public class clown extends Applet {
Image[] cln=new Image[8];
cln[0]=getImage(getDocumentBase(), "clown2.gif");
cln[1]=getImage(getDocumentBase(), "clown3.gif");
cln[2]=getImage(getDocumentBase(), "clown4.gif");
cln[3]=getImage(getDocumentBase(), "clown5.gif");
cln[4]=getImage(getDocumentBase(), "clown6.gif");
cln[5]=getImage(getDocumentBase(), "clown7.gif");
cln[6]=getImage(getDocumentBase(), "clown8.gif");
cln[7]=getImage(getDocumentBase(), "clown9.gif");
public void paint(Graphics g){
g.drawImage(cln[0], 0, 0, 0, 0, this);
g.drawImage(cln[0], 50, 10, 0, 0, this);
g.drawImage(cln[0], 100, 10, 0, 0, this);
g.drawImage(cln[0], 150, 10, 0, 0, this);
g.drawImage(cln[0], 200, 10, 0, 0, this);
g.drawImage(cln[0], 250, 10, 0, 0, this);
g.drawImage(cln[0], 300, 10, 0, 0, this);
g.drawImage(cln[0], 350, 10, 0, 0, this);
}Ive just noticed a mistake but that still doesnt resolve the problem it should read:
import java.applet.*;
import java.awt.*;
import javax.swing.*;
public class clown extends Applet {
Image[] cln=new Image[8];
cln[0]=getImage(getDocumentBase(), "clown2.gif");
cln[1]=getImage(getDocumentBase(), "clown3.gif");
cln[2]=getImage(getDocumentBase(), "clown4.gif");
cln[3]=getImage(getDocumentBase(), "clown5.gif");
cln[4]=getImage(getDocumentBase(), "clown6.gif");
cln[5]=getImage(getDocumentBase(), "clown7.gif");
cln[6]=getImage(getDocumentBase(), "clown8.gif");
cln[7]=getImage(getDocumentBase(), "clown9.gif");
public void paint(Graphics g){
g.drawImage(cln[0], 0, 0, 0, 0, this);
g.drawImage(cln[1], 50, 10, 0, 0, this);
g.drawImage(cln[2], 100, 10, 0, 0, this);
g.drawImage(cln[3], 150, 10, 0, 0, this);
g.drawImage(cln[4], 200, 10, 0, 0, this);
g.drawImage(cln[5], 250, 10, 0, 0, this);
g.drawImage(cln[6], 300, 10, 0, 0, this);
g.drawImage(cln[7], 350, 10, 0, 0, this); -
Problem loading jpg's with xml
I have looked through the forum to see if my problem was
raised but I could not find any topic that could help me out. So
here's my problem.
I have a simple photo viewer that load jpg's via xml.
Everything work perfect when I preview the movie in Flash or on my
desktop but as soon as it's uploaded to the server the jpg's so not
load. And everything is placed correct on the server.
Anyone got a clue why?Ok I found out that if you go directly to the movie in the
browser (http//www.url.com/name.swf) then it work perfect and the
photos load.
I got two other movies in the same html document. It's surely
here the problem occur. But why and what can I do to solve
it? -
JpegImagesToMovie to read single images
Hi,
I found that JpegImagesToMovie reads a list of images first and then creates the movie. Is that correct?
Can I make it to read image by image without the use of a Vector, just to load single images, one at the time and at the end to save it to video?
ThanksHi MDM_PS,
One idea is that we can used the ADO.Net knowledge, for example, we can use it like this “SELECT top xx from table…”, we can store the data in a new data source, then use this new data source in the unit test.
Tony also shared us a workaround , maybe you could refer to it here:
https://social.msdn.microsoft.com/Forums/en-us/f35d4e7c-1479-45f3-9985-38304e97b748/how-do-i-retrieve-value-from-single-cell-on-csv-file-using-data-driven-tests-for-codeduitest?forum=csharplanguage
Best Regards,
Jack
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.
Maybe you are looking for
-
I want to execute my application in any computer
Hi!I have a javafx application. I want to execute aplication from any computer.I suppose that I need have executable. How can I do that?thanks
-
Hello, so I have read a few discussions on transferring songs/playlist to a flash drive. But what I am looking for is can I replace my iPod classic in my car with a flash drive? So I have all my songs and playlist just like the iPod. And how do I do
-
How to set up multi-page brochure? Please help :(
Hi All I'm fairly new to InDesign and am struggling to set up a 6-page brochure - so either a roll fold or z-fold layout with 3 pages each side, similar to this. I can set up a 6 page A5 document, but, to help me when developing the design,rather tha
-
Specify either address number or address handle(AM53)?
Hi to All, when i am doing sales postings by using standard IDOC (ORDERS) i am getting this error "Specify either address number or address handle(AM53)" . Why this type of errors is come. Is it xi issue or Functional issue. My scenario is file to id
-
hi all i have a doubt the accounts ppl are not able to match PO with receipt for a particular PO when i checked that particular PO has invoice match option to PO this PO is for two items but in POabc super user-receiving-receipts -only one item has b