Loading A Jpg Image In An MC
I have designed a movie in which I want a jpg image to load on the bottom most layer of the mc (studios_scene) in it. I have put an action in the 2nd layer of the movie loadMovie("http://www.villagestudios.com/studios/bg.jpg", "bgClip"); The bottom most layer is an instance of an mc (square) and the instance name is bgClip. However, the target path is not correct as the movie gets loaded in the main scene and not in the bottom most layer of the mc studios_scene. I have tried out the target paths such as studios_scene.bgClip _root.studios_scene.bgClip _studios_scene.bgClip But nothing seems to be working. I have uploaded the .fla file. I would be grateful for any help. Thanks!
ActionScript.org Forums > Flash General Questions > Other Flash General Questions
Posted on: 04-21-2004, 06:18 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Dynamically Loading Image Problem (Image Covers Up The Animation)
I am trying to create a movie that uses a dynamically loading jpeg. I have some vertical lines that move across the movie and should go over the jpeg image. The problem I am having is the image covers the effects. I have tried to add "loadMovieNum("images/main_image.jpg", 0);" on Layer 2 and then on Layer 1 I have my animated lines that should go across the jpeg image. The line animation is on the bottom layer, but the image still covers the effects. Am I doing something wrong?
I have attached the .fla file for an example.
Dynamically Load An Image-Either The Image Resizes Or The Movieclip It's Loading To?
I will make a frame movie instance 400 X 400px called frame_mv.
I will use the script:
loadMovie("pic1.jpg", frame_mv);
If the pics being loaded were of different sizes. eg pic1.jpg was 1600 X 800
1- How would I make the pic resize to 400 X 400 or 400 X 200 so that it fits the frame_mv.
2- How would I make the frame_mv change size according to the pic dimensions being loaded?
Loading External Image > Image Appears Invisible
Hé,
I'm not posting here very much, so hi to anyone new.
I tried search for a solution to my problem, but I couldn't find one.
I'm using a button to load an external image:
code: on (Release) {
_root.temp.loadMovie("img.jpg");
}
Don't worry, both img.jpg and _root.temp (a box-shaped MC) excist.
When I press the button, _root.temp should be swaped by the image. Instead, it disappears, but no image appear. I have absolutely no idea what I'm doing wrong! I'm using Flash MX btw.
Here are my files:
http://www.cmd.tech.nhl.nl/users/regne200/test/
Loop While Image Is Loading / Fade Image As It Loads
Hi, another question:
I'm pulling a jpeg into a flash file using this:
loadMovie("digitalP_bg_2.jpg", "holder");
i have a shape over the image which is being pulled in, and this shape is supposed to fade after the jpeg is loaded - i've used straight forward tweening for the fade. howe ever, even though the loadMovie function is placed before the fade on the timeline, the jpeg takes a while to load and so the fade happens before the actual image has loaded.
my action scriptiing is very very minimal, i'd like to know if there's an easy enough solution to this. what i am thinking of possibly is creating a loop while the image is loading - provided that it isn't too complex to detect how much of the image is loaded.
any suggestions?
you can view the fla and swf here:
http://www.ponch.biz/flashtest/
cheers
Ponch
Basic Image View Not Dynamically Loading Image URL
What I have done Is added only a List Component to the stage and named it "lb". Then I'm Dynamically loading the data and label attributes from an external XML file. Now, I am Listening for the change event on 'lb" in order to create a new url request from the data property of the selected 'lb' item. Unfortunately, I am recieving this error message.
1067: Implicit coercion of a value of type flash.net:URLLoader to an unrelated type flash.display:DisplayObject.
Code:
var loader:URLLoader = new URLLoader();
var xml:XML;
var imgLoader:URLLoader;
loader.load(new URLRequest("http://www.xxxxxxx.com/Pictures.xml"));
loader.addEventListener(Event.COMPLETE, onLoaded);
lb.addEventListener(Event.CHANGE, itemChange);
// Loads XML data into List Component LB
function onLoaded(e:Event):void{
xml= new XML(e.target.data);
var il:XMLList = xml.Album[0].image;
for(var i:uint=0; i<il.length(); i++){
lb.addItem({data:il.attribute("url")[i],
label:il.attribute("title")[i]});
}
}
//Passes String used for URL
function loadImage(url:String):void{
imgLoader = new URLLoader();
imgLoader.load(new URLRequest(url));
imgLoader.addEventListener(Event.COMPLETE, imageLoaded);
}
//Creates Sprite from image url passed through loadImage
function imageLoaded(e:Event):void{
var image:Sprite = new Sprite();
image.width = 200;
image.height = 400;
image.x = 200;
image.y = 10;
image.addChild(imgLoader);
}
//OnChange .selected item passes URL String to LoadImage
function itemChange(e:Event):void{
loadImage(lb.selectedItem.data);
}
I'll admit I'm still a little new at this but I was thinking that URLRequest only need a String value wich I should be getting from "lb.selectingItem.data.toString()... atleast thats what it has been tracing. Any help is welcomed and thanks in advance.
Targeting Image Container After Loading Image In
hey guys,
i load an image from an array into a container MC.
after that i want to assign onPress function and read an image that's loaded.
but it seems after its loaded i can't do so, why is that and how do i get around this issue?
ActionScript Code:
loader_MC.loadMovie(_root.imageArray[0]);
//then
loader_MC.onPress = function(){ // this doesn't work as soon as there is an image there.
//do somthing
}
thanks!
Gallery Image Loading - Getting Image Width..help
Ladies and gents:
having a problem with my code somewhere; I'm stumped. Here's what i'm trying to do:
-When you click on a thumbnail in my gallery a load bar appears that is the width of the loading image
-While the image loads the load bar scales from full width to zero
-Once it finishes loading the image fades in
-Click on a new thumbnail, and the old image fades out, then the scrollbar is supposed to take the width of the NEW image and do the same thing
What is happening is that the scrollbar width does not set itself to the new image size until i click the thumbnail a second time...try this link to see what i mean. it's on the "portfolio" page.
http://www.lewisweb.ws/staging
here's the code:
Code:
//CONSTANTS
frame_x = 387; //the exact x coordinate where the box originates
frame_y = 184; //the exact y coordinate where the box originates
alphaSpeed = 5; //spped at which the pics fade in
//INITIAL SETTINGS
containerMC._alpha = 0;
containerMC._x = frame_x;
containerMC._y = frame_y;
//Fades in a picture loaded externally
MovieClip.prototype.loadPic = function(pic){
containerMC.fadeOldPic(); //fade out old picture
containerMC._alpha = 0;
this.loadMovie(pic); //load new pic
var loadIsComplete = false; //reset load checker
var w = containerMC._width;
loadBar._width = w; //set loadbar to new movieclip width
loadBar._alpha = 100; //make loadbar opaque
_root.onEnterFrame = function(){
var t = containerMC.getBytesTotal(), l = containerMC.getBytesLoaded();
loadIsComplete = (Math.round(l/t) == 1); //check to see if load completed
loadBar._width = w - ((l/t) * w); //sets width of loadbar dynamically
if (loadIsComplete){
containerMC._alpha += alphaSpeed; //if load is complete, fade pic in
}
//if the load is complete and the picture is fully faded in...
if (t != 0 && loadIsComplete && _root.containerMC._alpha == 100){
loadBar._alpha = 0; //make the load bar disappear
delete _root.onEnterFrame;
}
}
};
//Fades out an old picture...pretty self explanatory
MovieClip.prototype.fadeOldPic = function(){
_root.onEnterFrame = function(){
_root.containerMC._alpha -= alphaSpeed;
if (_root.containerMC._alpha == 0){
delete _root.onEnterFrame;
}
}
};
containerMC.loadPic("portfolio/westin.jpg");
stop();
ANY help will be appreciated!
Loading Image When The Image Is Created On The Fly
I hope the title made sense.
Off Topic:
If this has been covered elsewhere please let me know and I'll ask a moderator to remove this thread
I am trying to load a gif that represents a graph of Gold Prices. The image in question is updated periodically and can be used as long as it has been unaltered and has the name of the service provider that supplies it along with a few other conditions. It's from Kitco.com.
The image itself can be found here: http://www.kitco.com/images/live/gold.gif
The easiest way to this to my knowledge is to create an empty clip, give it an a name (mcImage) and load the image as follows:
_root.mcImage.loadMovie("http://www.kitco.com/images/live/gold.gif");
* I've used an onClipEvent(load) to fire the loadMovie function.
This should work and works pretty much first time every time whenever I've needed it before but it doesn't work for this one.
Any thoughts?
Thanks,
Dynamic Image Loading / Images Not Loading?
This is my first try at loading images with action script. I read through the forums, borrowed code, and adapted it.
///////////////////////////works fine
myvars = new LoadVars();
myvars.load("alldoorsdesc.txt");
myvars.onLoad = function (success) {
if (success) {
_root.doorsinsttxt.htmlText = myvars.d1txt+"<BR><BR>To order call us at 505 934 8888";
//I would like to create a for loop here so addidtional
//items can be added, is this possible?
_global.dr1txt = myvars.d1txt;
_global.dr2txt = myvars.d2txt;
_global.dr3txt = myvars.d3txt;
_global.dr4txt = myvars.d4txt;
_global.dr5txt = myvars.d5txt;
}
};
///////////////////////////doesn't trace to loaded door
var doormovie = _root.createEmptyMovieClip("imgmovie",_root);
doormovie._y = 100;
doormovie._x = 300;
doormovie._width = 300;
doormovie._height = 300;
function loadpic(num){
trace("inside loadpic" +num);
doormovie.createEmptyMovieClip("img"+num, num);
doormovie["img"+num].loadMovie("images/door"+num+".png");
//// I'm not sure about this line
doormovie["img"+num].onload = function(){trace("loaded door"+num);};
stop();
}
function unloadpic(num){cont["img"+num].removeMovieClip();}
function unloadAll(){cont.removeMovieClip();}
loadpic(1);// load the inital picture
----------------------------
Are all these functions loaded into the root visible from another movie that is imported with getURL ? Or do I have to copy the functions to that imported movie?
[AS] Loading Main Image While Loading Thumbnails
Hello,
I've got a custom gallery of sorts going on and there's a problem with it... There's 146 photos that have thumbnails loaded in and when clicked open up a larger photo in the presentation.
What happens is while the thumbnails are loading, if one that has loaded is clicked, the main image movieclip runs, but the photo itself doesn't load. It won't load until all the thumbnails are loaded in.
Is there a way to tell the clip to load it too? Or interrupt the thumbnail loading process then restart once the loaded image has completed?
Here's what I'm using...
[Thumbnail loader]
ActionScript Code:
stop();
var tSpacer:Number = 100;
var imagesT:Array = [];
var imagesM:Array = [];
var thisWid:Array = [];
var thisHgt:Array = [];
var imgNum:Number = 0;
var loadthis = "http://www.hpiracing.com/swf/2007/b2v/photoloader.php";
var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = parseMe;
import flash.display.*;
function loadBitmapSmoothed(url:String, target:MovieClip)
{
// Create a movie clip which will contain our
// unsmoothed bitmap
var bmc:MovieClip = target.createEmptyMovieClip("bmc", target.getNextHighestDepth());
// Create a listener which will notify us when
// the bitmap loaded successfully
var listener:Object = new Object();
// Track the target
listener.tmc = target;
// If the bitmap loaded successfully we redraw the
// movie into a BitmapData object and then attach
// that BitmapData to the target movie clip with
// the smoothing flag turned on.
listener.onLoadInit = function(mc:MovieClip)
{
mc._visible = false;
var bitmap:BitmapData = new BitmapData(mc._width, mc._height, true);
this.tmc.attachBitmap(bitmap, this.tmc.getNextHighestDepth(), "auto", true);
bitmap.draw(mc);
};
listener.onLoadStart = function(targetMC:MovieClip)
{
//trace("started loading "+targetMC);
targetMC._parent.mc_photoPreloader._visible = true;
targetMC._parent.mc_photoPreloader._width = 0;
};
listener.onLoadProgress = function(targetMC:MovieClip, lBytes, tBytes)
{
targetMC._parent.mc_photoPreloader._width = (lBytes/tBytes)*100;
};
listener.onLoadComplete = function(targetMC:MovieClip)
{
border._visible = false;
targetMC._parent.mc_photoPreloader._visible = false;
};
// Do it, load the bitmap now
var loader:MovieClipLoader = new MovieClipLoader();
loader.addListener(listener);
loader.loadClip(url, bmc);
}
function parseMe(success:Boolean):Void
{
trace("XML Loaded");
if(success)
{
thisChild = this.firstChild.firstChild.childNodes;
numItems = thisChild.length;
//trace(thisChild);
//trace("Loading " + numItems + " XML entries...");
for(i=0; i<numItems; i++)
{
//trace(thisChild[i].childNodes[1].firstChild.nodeValue + "
");
randMax = 5;
var rotRand:Number = random(randMax);
var rotRand2:Number = random(randMax);
if(rotRand > (rotRand/2))
{
rotRand2 = -(rotRand2);
}
mc_photoholder.attachMovie("mc_photoLoader", "mc_photoLoader" + i, mc_photoholder.getNextHighestDepth());
mc_photoholder["mc_photoLoader" + i].mc_photoPreloader._visible = false;
mc_photoholder["mc_photoLoader" + i]._y = (tSpacer * i) - 5;
mc_photoholder["mc_photoLoader" + i]._x = rotRand2;
mc_photoholder["mc_photoLoader" + i]._rotation = rotRand2;
//trace("Loading clip " + thisChild[i].childNodes + " into " + mc_photoholder["mc_photoLoader" + i].mc_photohere);
imagesT.push(thisChild[i].childNodes[0].firstChild.nodeValue);
imagesM.push(thisChild[i].childNodes[1].firstChild.nodeValue);
thisWid.push(thisChild[i].childNodes[2].firstChild.nodeValue);
thisHgt.push(thisChild[i].childNodes[3].firstChild.nodeValue);
//var thisWid:Array = [];
//var thisHgt:Array = [];
}
loadImages();
}
}
function loadImages():Void
{
var imgTotal:Number = imagesT.length;
//trace("imgTotal = " + imgTotal);
loadImg = imagesT;
loadBigImg = imagesM;
widths = thisWid;
heights = thisHgt;
for(j = 0; j < imgTotal; j++)
{
thisMc = _root.mc_photobarleft.mc_photoholder["mc_photoLoader" + j];
thisMc._highquality = 2;// = true;
thisMc.which = loadBigImg[j];
//trace("W = " + widths[j] + " and H = " + heights[j]);
thisMc.thisWid = widths[j];
thisMc.thisHgt = heights[j];
//trace("Which = " + thisMc.which);
loadBitmapSmoothed(loadImg[j],thisMc.mc_photohere);
thisMc.onRelease = function()
{
//trace("MC was clicked.");
var bigPicHolderMC:MovieClip = _root.mc_photoBigAnim.mc_bigPhotoHolder.mc_photoBigLoader;
var bigPicMC:MovieClip = bigPicHolderMC._parent._parent;
var bigPicFrameNo:Number = bigPicMC._currentframe;
//trace("Current Frame = " + bigPicFrameNo);
if(bigPicFrameNo == 1)
{
bigPicMC.play();
}
bigPicMC.which = this.which;
bigPicMC.thisWid = this.thisWid;
bigPicMC.thisHgt = this.thisHgt;
//trace("Which = " + this.which);
bigPicMC.unloadPhoto();
bigPicMC.loadBigPic();
}
}
}
mc_photodragger.onPress = function()
{
this.startDrag(false,108,0,108,250);
}
mc_photodragger.onRelease = function()
{
this.stopDrag();
}
mc_photodragger.onReleaseOutside = function()
{
this.stopDrag();
}
mc_photodragger.onEnterFrame = function()
{
//trace(this._y);
}
mc_photoholder.onEnterFrame = function()
{
//0 - 250
var maxDrag:Number = 250;
var curDrag:Number = mc_photodragger._y;
var perc:Number = Math.round(((curDrag/maxDrag)) * (this._height - maxDrag - tSpacer));
//trace("Perc = " + perc)
this._y = -(perc);
}
trace("Loading XML");
myXML.load(loadthis);
[Main Image Loader]
ActionScript Code:
var which:String;
var thisWid:Number;
var thisHgt:Number;
var maxRight:Number = 500;
var keepmoving:Number;
var playStatus:String;
mc_bigPhotoHolder.mc_photoPreloader._visible = false;
mc = new MovieClipLoader();
preload = new Object();
mc.addListener(preload);
function loadBigPic()
{
var thisTarget:MovieClip = this.mc_bigPhotoHolder;
//trace("W = " + this.thisWid + " and H = " + this.thisHgt);
mc.loadClip(this.which, thisTarget.mc_photoBigLoader);
//trace("New num = " + (Number(this.thisWid) + 20));
var bgWid:Number = Number(this.thisWid) + 20;
var bgHgt:Number = Number(this.thisHgt) + 50;
var thisY:Number = Math.round((maxRight - (bgWid - 20))/2);
trace("Moving photo to " + thisY);
thisTarget.mc_photoBigBg._width = bgWid;
thisTarget.mc_photoBigBg._height = bgHgt;
thisTarget._x = thisY;
thisTarget.mc_photoPreloader._y = bgHgt - 20;
}
preload.onLoadStart = function(targetMC)
{
//trace("started loading "+targetMC);
targetMC._parent.mc_photoPreloader._visible = true;
targetMC._parent.mc_photoPreloader._width = 0;
};
preload.onLoadProgress = function(targetMC, lBytes, tBytes)
{
targetMC._parent.mc_photoPreloader._width = (lBytes/tBytes) * thisWid;
trace("thisWid = " + thisWid);
};
preload.onLoadComplete = function(targetMC)
{
border._visible = false;
targetMC._parent.mc_photoPreloader._visible = false;
};
Please let me know if it can be done.
Thanks!
Image Loading
Our website http://www.tbtsun.com (e-commerce) is going public soon. But it is too large! It has many high quality pictures and I wanted to know if there was a way for the images to load as they want to see them! If someone can do this for me or walk me through step-by-step they will recieve much credit on the website. this website with be viewed by thousands!! PLEASE PUT YOUR INPUT! e-mail me at thesmack@optonline.net
Loading Image On The Fly
I'm want to load an image (image1.gif) into a flash movie, by referencing it's name and location - rather than embedding the image onto the actual movie. This would allow me to change the image by creating a new image and replacing the image1.gif file on my machine.
Can anyone help me please !!!!
Image Loading
Friends,
I would like give an option of uploading an image on to a movie (that is on a MC) by the user. Is there a tutorial or any guidance availble??
Thank you very much,
FK
Image Loading
does anybody know how to control when an image loads in a .swf?
all the images are loading when the website is booting up. id like to make them load when they are called
the website is
http://amourdecroix.com.previewmysite.com
aloha
cortland
Loading Bar For Each Image
I have several galleries within my flash movie. The only problem that I have encountered is that I cannot find a way to make the movie show a loading bar while each Large Image loads. you can view the movie at http://apertureiseverything.tripod.com/mainpage.htm. When you click gallery and then click weddings I am trying to first, get a loading bar to appear as the index loads and then make a loading bar appear if you click on any of the index pictures. I have been told to make a separate movie for each image, but then how would I make my Gallery controller move from "previous movie" to "next movie". The way i have it now is that each image is in a frame and the controller goes from previous frame to next frame. What is the best way to accomplish this? THanks
Loading Image
Does anybody know how to make a preloader for loading external JPEGs in Flash MX?
I have a list of buttons that load a pic when clicked, and I want to create a progress bar and a % box showing the user the loading status for the image. Is is also possible for text? If so, how do you do it?
Thanks
Loading Bar For Each Image
I am in the process of creating a website for my photography business. On the site I am going to have a gallery of my pictures. My goal is to make it so that when you click on a gallery a gallery index will appear. And then when you click on a picture that picture will appear. I was wondering if there was any way to make it so that a loading bar will appear as the gallery is loading and also when you clikc on an image. It is better understood if you see it. I am more than willing to email the fla file to someone if they would care to look at it. It is online at http://apertureiseverything.tripod.com/mainpage.htm
Is there any way to make a preloading bar for just a graphic and not the entire movie?
Image Loading Help
Ok... here's my problem... its pretty minor, but annoying none the less...
I'm loading images to my movie into blank movie clips but the problem is the top left corner of the image loads to the 0,0 point in the movie clip which makes it harder for me to center the image where I want it...
is there any way that I can load the center of the image to the 0,0 point of the empty movie clip??
Loading A Jpg Image In An MC
I have designed a movie in which I want a jpg image to load on the bottom most layer of the mc (studios_scene) in it. I have put an action in the 2nd layer of the movie
loadMovie("http://www.villagestudios.com/studios/bg.jpg", "bgClip");
The bottom most layer is an instance of an mc (square) and the instance name is bgClip. However, the target path is not correct as the movie gets loaded in the main scene and not in the bottom most layer of the mc studios_scene. I have tried out the target paths such as
studios_scene.bgClip
_root.studios_scene.bgClip
_studios_scene.bgClip
But nothing seems to be working.
I have uploaded the .fla file. I would be grateful for any help.
Thanks!
Image Not Loading
Hi!
I want to make a photoalbum for school, so that the photos are loaded external. (with name "pic1, pic2, ..., pic12")
I managed to do this in an easy way, but when I uploaded it on the server (tripod server), it didn't work anymore.
After long work, I realised that the picture seems to be too big !
A picture with 33 KB loads just perfect, but the size I normally have is 143 KB.
Does the method "mc.loadMovie();" stop after a certain time? What can I do, so I can keep the size at 143 KB? (want to upload pictures from a digicam)
Thanks a lot in advance!
Image Loading
I'm using Flash MX Professional 2004
I have a fla that is 640x480, on the stage resides an empty movieclip that is a container into which I load images of various (in both the horizontal and vertical, some are rectangular and some are square) sizes. The movieclip container (MC_container) _x and _y do not change. The _x position is 448.8 and the _y position is 164.45. What I need is a calculatation that will resize the images I load into the MC_container so that if the width of the images exceeds (once loaded into the MC_container) the 640 boundary it will subtract 1, or whatever number, until the images width no longer exceeds the 640 boundary. Does anyone have a good solution to this?
Thank you,
Jpg Image Loading
if somebody know how to set the height and width of a loaded jpg image with AS 1.0 and payer 6. kindly let me know if anyone have an answer
psb
Keep Image After Loading
Beginner question here.
I am working with flash 8 and need to know how to keep things around after loading them. I know it sounds stupid but I can not find it. Say I have some borders being drawn and an image loading. I then put a "stop()" to have it not loop and then want to load some text for links and such but can not figure out how to have the original image run it's course and stick around while I load other items.
As of now it runs it's course and then dissapears when I start to load other items at further frames. I hope I explained this well enough?
Loading An Image Into An SWF
Ok...
Is it possible to allow someone using your SWF file to upload their own photo image?
Example:
I create a flash to add silly things to a photo.. Thought balloons etc.. like scrap-booking
can I allow someone viewing this animation to load their own picture into the swf and these save the picture after altering it?
Thanks for the help!
Loading Image Into Swf
Hi
This example upload a image to the server.
http://flash-db.com/Tutorials/upload/index.php
I want to load this uploaded image into a new movie which willl be on the same htlm page. can somone help me with this.
Image Loading And Etc
I'm using as2, heres my question. I want to generate a list of images to be loaded into a movie clip, without listing them somewhere like an xml or text file, so basically I need flash to search a directory and get all the images there, and put them into an array. A point in the right direction would be greatly appreciated. Not like I don't like job security, but this would be nice so I can just tell the client to upload a photo to the appropriate directory and it will show up next load.
thanks in advance.
Image Loading
New to AS3 and learning to gain knowlegde and the jump from AS2.
I am using an xml laoding code and I can see the image name if placed into a text box or trace, but woud like to load this actual image up into an empty MC.
Can anyone help with this, a simple code to display an image so I know how it works and can take it from there.
many thanks Si
[F8] Loading An Image.
photos.tribalconquest.com
When a picture is clicked it loads a external .PNG file.
How can i have the image load before the animation starts?
Thanks.
[CS3] Loading Image
Hi,
I know this is silly and the answer must be easy but I can't figure it out...
I made a button and on click I want a larger image be displayed on the page along with some text under the image.
I am building a gallery with multiple thumbnails.
Thanks for your help!
Loading An Image?
I'm trying to load a few .gif images, set them as a background image and fade them out. On my pc it all works, but on my host it's either not downloading fast enough or not downloading the images at all. I've not got an eventlistener checking for complete atm but think I'll put that in now to see if it helps.
Loading Image
Hi, I am new to actionscripting and I am facing a problem…
I have two movie clips on stage as mcA and mcB and mcA has a button inside it. Now when I click on mcA (which acts as a button) an online image should load in mcB.
I tried solving but seems all in vein.
Please help.
Image Loading?(or Is It?)
I can't seem to get this to work quite right. I have of course changed "mydomain" to the correct name. I have no clue why it it's loading the background image...(I'm pretty sure it is loading the mp3). I have uploaded to my server also.
Code:
function LoadUpdate()
{
SongLoadPercent = CurrentSong.getBytesLoaded() / CurrentSong.getBytesTotal() * 100;
_root.bLoaded = CurrentSong.getBytesLoaded();
_root.bTotal = CurrentSong.getBytesTotal();
trace (SongLoadPercent);
Bar._xscale = SongLoadPercent;
} // End of the function
function LoadBackground()
{
BGLoader = new MovieClipLoader();
BGLoader.loadClip("http://www.mydomain.com/TTR/" + Name + "-bg.jpg", _root.BGHolder);
BGLoader.onLoadComplete = function ()
{
gotoAndStop(80);
};
} // End of the function
stop ();
BGDimmer._alpha = 100 - BGBrightness;
SongLoadPercent = 0;
CurrentSong = new Sound();
CurrentSong.loadSound("http://www.mydomain.com/TTR/nonexistant.mp3", false);
CurrentSong.loadSound("http://www.mydomain.com/TTR/" + Name + ".mp3", false);
CurrentSong.onLoad = function ()
{
clearInterval(LoadUpdateInterval);
LoadBackground();
};
LoadUpdateInterval = setInterval(LoadUpdate, 50);
Image Loading
Hi, I'm trying to build a function which will take an XML list of image URLs and an MC and load the images into the MC as a gallery.
Eventually, it will resize the MC's height based on the loaded heights of the images (using a maxWidth to wrap the images to the next line when they reach the edge of the MC)
But right now I'm just trying to get the images to load and having much difficulty.
Here's what I have so far:
ActionScript Code:
var xml = new XML ("<span class = 'imageGallery'><image>http://www.dirtythug.com/whatever/downloads/bg01.gif</image><image>http://www.dirtythug.com/whatever/downloads/bg02.gif</image><image>http://www.dirtythug.com/whatever/downloads/bg03.gif</image><image>http://www.dirtythug.com/whatever/downloads/bg04.gif</image><image>http://www.dirtythug.com/whatever/downloads/bg05.gif</image><image>http://www.dirtythug.com/whatever/downloads/bg06.gif</image><image>http://www.dirtythug.com/whatever/downloads/bg07.gif</image><image>http://www.dirtythug.com/whatever/downloads/bg08.gif</image><image>http://www.dirtythug.com/whatever/downloads/bg09.gif</image></span>");
parseGallery(MCa, xml.firstChild);
function parseGallery (MC, xml)
{
for (var i = 0; i < xml.childNodes.length; i++)
{
if (xml.childNodes[i].nodeName != "image")
{
trace("Image gallery parsing error: " + xml.childNodes[i] + " is not an image node.");
}
var clipURL:String = xml.childNodes[i].firstChild;
var mclListener:Object = new Object();
mclListener.onLoadInit = function(){
trace(clipURL);}
mclListener.onLoadComplete= function(){
trace("Loaded width:" + this._width);}
var imageLoader:MovieClipLoader = new MovieClipLoader();
imageLoader.addListener(mclListener);
var imageMC:MovieClip = MC.createEmptyMovieClip("image" + i, MC.getNextHighestDepth());
imageLoader.loadClip(clipURL, imageMC);
}
};
Any help or helpful links would be greatly appreciated!!
Thanks a bunch!
AS 1.0 For Loading Image
still using MX.
I heard w/ new ver, images can be loaded directly.
is there a work-around for MX or you still need to
turn Jpeg into .swf first inorder to load?
thanx.
Image Loading Help
hey guys im pretty new to flash, just building my portfolio, and need a bit of help with loading images. heres the link to my site: (Mite take a while to load, havnt optimized it yet )
HTML Code:
http://www.vivd.com.au
How would i go a bout getting the images to load in a full view while still in the same browser e.g.
HTML Code:
http://www.hellocolor.com/
like hello colors works when you click on them they load with the full work while still in the one movie clip. (Color>then click on any work)
Any help would be great
Cheers
joey
Image Loading?
I'm looking for a little help - I would like to create a Flash project that allows the user to open an image file, and then interact with it, then save a *.txt file based on their actions.
It would be entirely local - not on a website or anything.
Basically, the user can place any number of image files into a directory, and I want them to be able to open one of them at a time, and then Flash would split the image up into separate bitmaps.
I can't figure out how to get the list of images, so that the user can choose one and then dynamically load the one they picked. Any help is very much appreciated. Thanks!
Loading Image Via XML
Hey All,
I am working on writing a simple .swf that displays a program name, a description of the program and the programs icon. I have been able to have it make a list of programs and when you click on the program name it shows the description of the program. Now I am trying to add the part where it loads the image as well. I have created an empty movieclip on the stage called applogo_mc and want the image specified in the xml to be loaded into the movieclip when the program name is clicked on but have no idea how to go about doing that.
Here's what I have for the XML:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<channel>
<appreviews>
<program>
<programname>Program 1</programname>
<description>Program Description</description>
<logoimage>programimage.jpg</logoimage>
</program>
</appreviews>
</channel>
and heres the actionscript code.
ActionScript Code:
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onLoaded);
listofapps_mc.addEventListener(Event.CHANGE, itemChange);
function itemChange(event:Event):void
{
textbox_mc.text = listofapps_mc.selectedItem.data;
}
var xml:XML;
function onLoaded(event:Event):void
{
xml = new XML(event.target.data);
var il:XMLList = xml.appreviews.program;
for(var i:uint=0; i<il.length(); i++)
{
listofapps_mc.addItem({data:il.description.text()[i],
label:il.programname.text()[i]});
}
}
loader.load(new URLRequest("apps.xml"));
Any help is greatly appreciated. Thanks in advance.
BC
Image Loading
hi friends,
I am developing an image gallery. The problem is it load the image slowly. Is it any way to speed up the image loading.. I am using this code to load image..
ActionScript Code:
loadBitmapSmoothed("image.jpg",pic_mc);
import flash.display.*;
function loadBitmapSmoothed(url:String, target:MovieClip) {
var bmc:MovieClip = target.createEmptyMovieClip("bmc", target.getNextHighestDepth());
var listener:Object = new Object();
listener.tmc = target;
listener.onLoadInit = function(mc:MovieClip) {
mc._visible = false;
var bitmap:BitmapData = new BitmapData(mc._width, mc._height, true);
this.tmc.attachBitmap(bitmap,this.tmc.getNextHighestDepth(),"auto",true);
bitmap.draw(mc);
};
listener.onLoadComplete = function(mc:MovieClip) {
};
// Do it, load the bitmap now
var loader:MovieClipLoader = new MovieClipLoader();
loader.addListener(listener);
loader.loadClip(url,bmc);
}
Image Loading
Hello everyone, I am new to these forums but have been doing flash for a while now. I am a senior in highschool and for my last project for school I am making a flash website for the football team, I did this last year for the soccer team, and this year for the football and soccer team. Since rarely anyone at school knows a lot about flash I would like to make it as easy for them to update as possible. The main part is the picture section. We take pictures on the side lines and then I put them on the website, it was simple for me because I know flash. But I would like to make it really simple so someone who knowns nothing about flash can update this site with pictures. Right now I have the website loading in a different swf file per game and was wanting to keep it that way. It works nice because it preloads each game when you want to view that game. But now I am wanting to make it where action script looks into a directory and lets say for game 1 I have 10 photos, it automatically places the 10 pictures in the swf and allows me to scroll through them, then game 2 has 13 photos and I want to do the same thing. My main question is, is there a way to have flash load an a random number of images from a directory? Thanks guys
How To Mod An Image After Loading It?
im trying to load images, and rezise them all to the same size, so considering the attached code:
1)how can i get the width/height of the image i just loaded? whatever i try i always get the default size of the movie clip.
2)How come if i set the width and height to 20, the bigger image still has more height?
My idea is load a set of images off a folder and scale them so they have the same width/height, distortion is not important.
Attach Code
var mc:MovieClip = this.createEmptyMovieClip("mc", this.getNextHighestDepth());
var image:MovieClip = mc.createEmptyMovieClip("image", mc.getNextHighestDepth());
image.loadMovie("http://www.w3.org/Icons/w3c_main.png");//image is 315*48
var image2:MovieClip = mc.createEmptyMovieClip("image2", mc.getNextHighestDepth());
image2.loadMovie("http://images.pearsoned-ema.com/jpeg/large/9780321336293.jpg");//image is 504*648
image._xscale=20;
image._yscale=20;
image._y=200;
image2._yscale=20;
image2._xscale=20;
Help With Loading New Image From Xml
i have an image carousel, images being pulled from xml..right now, when you click the image, it slides over and some text appears also comming from the same xml file.. xml set up like this
<?xml version="1.0"?>
<icons>
<icon image="image/Dunne_Lexan.crushed.png" content="Test" />
<icon image="image/Eley,-Howard_Lexan.crushed.png" content="Test" />
<icon image="image/Gagne_Lexan.crushed.png" content="Test" />
<icon image="image/Hackney_Lexan.crushed.png" content="Test" />
<icon image="image/Hastings_Lexan.crushed.png" content="Test" />
<icon image="image/Klee,-Randall_Lexan.crushed.png" content="Test" />
<icon image="image/Rasmussen_Lexan.crushed.png" content="Test" />
<icon image="image/Snyder,-Chris_Lexan.crushed.png" content="Test" />
</icons>
what I would like to happen, is when the user clicks the image, and it slides over, I want a new image to appear from the same xml file
here is my AS
Attach Code
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function() {
var nodes = this.firstChild.childNodes;
numOfItem = nodes.length;
for(var i=0; i<numOfItem; i++) {
var t = home.attachMovie("logo", "logo"+i, i+1);
t.angle = i * ((Math.PI*2)/numOfItem);
t.onEnterFrame = mover;
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;
}
}
xml.load("icons.xml");
function released() {
for(var i=0; i<numOfItem; i++) {
var t:MovieClip = home["logo"+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, 100, 1, true);
var tw4:Tween = new Tween(t, "_y", Strong.easeOut,t._y, 320, 1, true);
var tw5:Tween = new Tween(theText, "_alpha", Strong.easeOut, 0, 100, 1, true);
theText.text = t.content;
var s:Object = this;
tw.onMotionStopped = function() {
s.onRelease = unReleased;
}
}
}
}
function unReleased() {
delete this.onRelease;
var tw:Tween = new Tween(theText, "_alpha", Strong.easeOut,100, 0, .5, true);
for(var i=0; i<numOfItem; i++) {
var t:MovieClip = home["logo"+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);
tw.onMotionStopped = function() {
for(var i=0; i<numOfItem; i++) {
var t:MovieClip = home["logo"+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 mover() {
this._x = Math.cos(this.angle) * radiusX + centerX;
this._y = Math.sin(this.angle) * radiusY + centerY;
var s:Number = new Number();
s = (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)/14000;
}
Image Loading
Greetings!
Well the scene is this:
I created a scrolling bar with about 30 tumbs.
Each tumb will load an image in the root background.
For example:
I'm pressing on a tumb, and a picture shows up in an other section of the screen, but in the same movie clip.
Its sound simple, but when I did it, the loaded image started to move up with the scrolling... =)
Its soppose to look like an Iframe in HTML:
a href="examplelink.html" "_iframe"
Thank you!
Waiting for comment!
ilya1992
Image Loading
hi friends,
I am developing an image gallery. The problem is it load the image slowly. Is it any way to speed up the image loading.. I am using this code to load image..
Attach Code
loadBitmapSmoothed("image.jpg",pic_mc);
import flash.display.*;
function loadBitmapSmoothed(url:String, target:MovieClip) {
var bmc:MovieClip = target.createEmptyMovieClip("bmc", target.getNextHighestDepth());
var listener:Object = new Object();
listener.tmc = target;
listener.onLoadInit = function(mc:MovieClip) {
mc._visible = false;
var bitmap:BitmapData = new BitmapData(mc._width, mc._height, true);
this.tmc.attachBitmap(bitmap,this.tmc.getNextHighestDepth(),"auto",true);
bitmap.draw(mc);
};
listener.onLoadComplete = function(mc:MovieClip) {
};
// Do it, load the bitmap now
var loader:MovieClipLoader = new MovieClipLoader();
loader.addListener(listener);
loader.loadClip(url,bmc);
}
Loading New Image From Xml
i have an image carousel, images being pulled from xml..right now, when you click the image, it slides over and some text appears also comming from the same xml file.. xml set up like this
<?xml version="1.0"?>
<icons>
<icon image="image/Dunne_Lexan.crushed.png" content="Test" />
<icon image="image/Eley,-Howard_Lexan.crushed.png" content="Test" />
<icon image="image/Gagne_Lexan.crushed.png" content="Test" />
<icon image="image/Hackney_Lexan.crushed.png" content="Test" />
<icon image="image/Hastings_Lexan.crushed.png" content="Test" />
<icon image="image/Klee,-Randall_Lexan.crushed.png" content="Test" />
<icon image="image/Rasmussen_Lexan.crushed.png" content="Test" />
<icon image="image/Snyder,-Chris_Lexan.crushed.png" content="Test" />
</icons>
what I would like to happen, is when the user clicks the image, and it slides over, I want a new image to appear from the same xml file
here is my AS
Attach Code
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function() {
var nodes = this.firstChild.childNodes;
numOfItem = nodes.length;
for(var i=0; i<numOfItem; i++) {
var t = home.attachMovie("logo", "logo"+i, i+1);
t.angle = i * ((Math.PI*2)/numOfItem);
t.onEnterFrame = mover;
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;
}
}
xml.load("icons.xml");
function released() {
for(var i=0; i<numOfItem; i++) {
var t:MovieClip = home["logo"+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, 100, 1, true);
var tw4:Tween = new Tween(t, "_y", Strong.easeOut,t._y, 320, 1, true);
var tw5:Tween = new Tween(theText, "_alpha", Strong.easeOut, 0, 100, 1, true);
theText.text = t.content;
var s:Object = this;
tw.onMotionStopped = function() {
s.onRelease = unReleased;
}
}
}
}
function unReleased() {
delete this.onRelease;
var tw:Tween = new Tween(theText, "_alpha", Strong.easeOut,100, 0, .5, true);
for(var i=0; i<numOfItem; i++) {
var t:MovieClip = home["logo"+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);
tw.onMotionStopped = function() {
for(var i=0; i<numOfItem; i++) {
var t:MovieClip = home["logo"+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 mover() {
this._x = Math.cos(this.angle) * radiusX + centerX;
this._y = Math.sin(this.angle) * radiusY + centerY;
var s:Number = new Number();
s = (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)/14000;
}
Image Not Loading
I am trying to load an RSS feed into my flash application, which gives the URL of an image I want to load. This script works fine locally, but when I upload to my server (goDaddy deluxe hosting) the images won't load. Here is the URL: http://www.laurabeach.com/fbtesting/photography.html
Any Ideas?
Attach Code
stop();
Security.allowDomain("photocast.mac.com");
//Security.loadPolicyFile("crossdomain.xml");
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest("http://photocast.mac.com/beachlaura/100015/rss"));
function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
ParsePhotos(xmlData);
}
function ParsePhotos(photoInput:XML):void {
var myPhotos:Array = new Array();
var num:int = 0;
var photoList:XMLList = photoInput.channel.item;
for each (var photoElement:XML in photoList) {
myPhotos[num] = photoInput.channel.item.description[num].text();
num++;
}
var rawData:String;
var startNum:int;
var endNum:int;
var theSource:String;
var photoNum:int = myPhotos.length;
for (var i:int = 0; i < photoNum; i++) {
rawData = myPhotos[i];
startNum = rawData.indexOf("img") + 9;
endNum = rawData.indexOf(".jpg") + 4;
theSource = rawData.substring(startNum, endNum);
myPhotos[i] = theSource + "?derivative=medium&source=web.jpg&type=medium";
}
var atNum:int = 0;
var firstImage:String = myPhotos[atNum].toString();
imgLoader_mc.source = firstImage;
imgLoader_mc.addEventListener(ProgressEvent.PROGRESS, preload);
imgLoader_mc.addEventListener(Event.COMPLETE, done);
//var loader:Loader = new Loader();
//loader.load(firstImage);
//addChild(loader);
//loader.addEventListener(ProgressEvent.PROGRESS, preload);
function preload(event:ProgressEvent):void {
var percent:int = Math.floor((imgLoader_mc.bytesLoaded / imgLoader_mc.bytesTotal)*100);
percent_txt.text = percent.toString() + "%";
}
function done(event:Event):void {
percent_txt.text = "";
}
next_btn.addEventListener(MouseEvent.MOUSE_DOWN, nextPhoto);
function nextPhoto(event:MouseEvent):void {
if(atNum < myPhotos.length - 1) {
atNum++;
var nextImage:String = myPhotos[atNum].toString();
imgLoader_mc.source = nextImage;
}else{
atNum = 0;
nextImage = myPhotos[atNum].toString();
imgLoader_mc.source = nextImage;
}
}
}
Edited: 06/23/2008 at 07:08:15 AM by Laura Beach
Help Loading Image With XML
I am working on trying to get use an XML file to load information that is called upon. So far I was able to load the XML file and call out text and display in flash. I am having an issue getting actionscripts to grab the URL string from the XML of the image i want to use. I am having trouble with my imageLoader finding the URL. Maybe Im parsing it wrong? anyway below is the XML and attached is my AS3.
<?xml version="1.0" encoding="ISO-8859-1"?>
<sherwoodGuide>
<loc1>
<bld>Reception Area </bld>
<desc>Information for loc 1 goes here</desc>
<image pic_url="whatever1.jpg" />
</loc1>
</sherwoodGuide>
Thanks for the help.
Attach Code
var myXML:XML = new XML();
var path:String;
var imgLoader:Loader = new Loader();
imgLoader.load(new URLRequest(path));
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, handleComplete);
xmlLoader.load(new URLRequest("sherwoodText.xml"));
function handleComplete(event:Event):void {
//Load in XML
myXML = new XML(event.target.data);
//ignore spaces
myXML.ignoreWhitespace;
trace("loaded");
//Set the text boxes to proper data
display1.text =myXML.loc1.bld;
display2.text =myXML.loc1.desc;
path =myXML.loc1.image;
addChild(imgLoader);
trace(myXML.loc1.image);
trace("displayed");
}
//} catch(err:Error) {
//trace("Could not parse loaded content as XML:
" + err.message);
//}
//}
|