(HELP) - Loading multiple external images error #1010
I'm a newbie at Flash and spent the whole day trying to fix this one problem and can't seem to fix it no matter what I do.
I'm using Action Script 3.0, CS5 on Windows 7.
I'm trying to load two external images (thumbnail images) in the loader "see image below for reference", where the full image size will be. However, I am getting this error when testing my movie. What am I doing wrong?
Test Movie error message:
"port1_btn
TypeError: Error #1010: A term is undefined and has no properties.
at index_fla::MainTimeline/fl_MouseClickHandler_6()"
"port2_btn
TypeError: Error #1010: A term is undefined and has no properties.
at index_fla::MainTimeline/fl_MouseClickHandler_7()"
FYI:
Loader instance name: mainLoader
Thumbnail #1 instance name: port1_btn
Thumbnail #2 instance name: port2_btn
This is my code
Go into your Flash Publish Settings and select the option to Permit Debugging. Then the error messages could include an indication of which lines are causing the problem.
And just for the sake of asking since the code is somewhat minimal... is the mainLoader inside a container named portfolioBkgd?
Similar Messages
-
If you load say 3 external images in AS3 and want to run a function "useImages()" only once all three images have loaded what is the best way of listening for them to complete loading.
EG;
loader1.addEventListener(Eveent.COMPLETE, incLoader)
loader2.addEventListener(Eveent.COMPLETE, incLoader)
loader2.addEventListener(Eveent.COMPLETE, incLoader)
function incLoader(event:Event)
numLoaded ++
if (numLoaded == 3)
useImages()
There must be a better way than the above.
Any feedback would be much appreciated
ThanksHere's a set of functions I used to load pages into a flip page magazine app. They keep track of how many pages are supposed to load and how many actually load. I also used an XML file that the web people can update so that it loads different images. You can add the loader objects in the loaders Array into any DisplayObjectContainer:
var pageCount:int = 3;
var pagesLoaded:int = 0;
var loaders:Array = new Array;
public function loadPage(aPage:String):void
var pictLdr:Loader = new Loader();
var pictURLReq:URLRequest = new URLRequest(aPage);
pictLdr.load(pictURLReq);
pictLdr.contentLoaderInfo.addEventListener(Event.COMPLETE, imgLoaded);
pictLdr.addEventListener(IOErrorEvent.IO_ERROR, pictErrorHandler);
loaders.push(pictLdr);
updateLoadText();
private function imgLoaded(event:Event):void
pagesLoaded++;
addPagesToFlipBook();
private function pictErrorHandler(event:IOErrorEvent):void
var ldrInfo:LoaderInfo = LoaderInfo(event.target);
loaders.splice(loaders.indexOf(ldrInfo.loader), 1);
pageCount--;
addPagesToFlipBook();
private function updateLoadText():void
errorText.text = "Loading image " + (pagesLoaded + 1) + " of " + pageCount + "..."
private function addPagesToFlipBook():void
updateLoadText();
if (pagesLoaded == pageCount)
... do more stuff
*edit* How do I create a code window for code? -
Hi helpers !@
im trying to load multiple external png files from a folder. the path for the images comes from an xml attribute and i got no problem with the path. The error message pops on when i try to add the loader into an array for later use and then when im done remove each child i created. There is something in my pratice that is not ok , i meen i know im wrong with at some point ! Duh theres an Error message for each loader i create .. .
ReferenceError: Error #1069: Property Loader not found on flash.display.LoaderInfo and there is no default value.
here some code , pls guide me !
function affichageM(){
var nodeM:XML;
for each ( nodeM in listeM ){
var reqM:String = localLogoM + nodeM.attribute("icon_max2");
var imageLoaderJ = new Loader();
imageLoaderJ.contentLoaderInfo.addEventListener(Event.INIT,addM);
imageLoaderJ.load(new URLRequest(reqM));
// just counting for fun
iNodeM ++;
function addM(e:Event){
try { var l_img:Loader = Loader(e.currentTarget.Loader);
l_img.name = "imageLoaderJ" + mc_ArrayImg.length().toString() ;
l_img.visible = false;
mc_ArrayImg.push(l_img);
mc_Jour.addChild(l_img);
//calling the fucntion that will animate all img in the array and had some text to them.....
drawMyImg(mc_ArrayMImg.length()-1);
catch (error:Error) {
//just counting errors for fun
iErreurM++;
var errorMessage:TextField = new TextField();
errorMessage.autoSize = TextFieldAutoSize.LEFT;
errorMessage.textColor = 0xFF0000;
errorMessage.text = error.message + " " + mc_Jour.numChildren + " " + mc_ArrayImg.length;
errorMessage.x = 10*iErreurM;
addChild(errorMessage);
return;Hi, I'm not sure you are on the correct forum. This is the Flash Player forum. When you first open your thread, look to your right "More like This" and perhaps one of those forums would be helpful. Perhaps the Flash forum?
Thanks,
eidnolb -
Need help - Loading Multiple instance of the same image
Hi guys,
I have been trying for days now, to get this working but i'm not able to do so, i have been trying to get actionscript to load multiple instance of an image file using a for loop.
Would anyone be able to enlighten me on this? the other functions are located on a seperate actionscript file.
many thanks
part of the code is as follows: (it works if i use the graphic class)
function makeRoad():void{
var row:int = 0;//the current row we're working on
var block;//this will act as the block that we're placing down
for(var i:int=0;i<lvlArray.length;i++){//creating a loop that'll go through the level array
if(lvlArray[i] == 0){//if the current index is set to 0
block = new EmptyBlock();//create a gray empty block
block.graphics.beginFill(0x333333);
block.graphics.drawRect(0,0,25,25);
block.graphics.endFill();
addChild(block);
//and set the coordinates to be relative to the place in the array
block.x= (i-row*22)*25;
block.y = row*25;
} else if(lvlArray[i] == 1){//if there is supposed to be a row
//just add a box that will be a darker color and won't have any actions
block = new Shape();
block.graphics.beginFill(0x111111);
block.graphics.drawRect(0,0,25,25);
block.graphics.endFill();
block.x= (i-row*22)*25;
block.y = row*25;
roadHolder.addChild(block);//add it to the roadHolder
} else if(lvlArray[i] is String){//if it's a string, meaning a special block
//then create a special block
block = new DirectBlock(lvlArray[i],(i-row*22)*25,row*25);
addChild(block);
for(var c:int = 1;c<=16;c++){
if(i == c*22-1){
//if 22 columns have gone by, then we move onto the next row
row++;@Kalisto - i don't think that is the real issue here since we cannot see what is in the DirectBlock class and the OP has not mentioned any compiler errors.
Desmond - it appears as though you are constructing this in the form of a 'grid' - correct? but the problem i believe is that the positioning is not being determined properly - to do something like you want here (i think) you would use what known as a 'nested loop' - this means the 'outer' loop handles iteration of the 'rows' and an 'inner' loop handles the iteration of the columns. the way you have this set up above, you are attempting to use the 'row' value to position both the row and column - this wont work and it's likely that everything is getting 'stacked' on top of one another.
may want to structure things a bit more like this:
function makeRoad():void {
var index:int = 0;
for(var row=0; row<22; row++) {
for(var col=0; col<22; col++) {
index = (row*22)+col;
if(lvlArray[index] == 0) createBlock(0x333333, col*25, row*25);
if(lvlArray[index] == 1) createBlock(0x111111, col*25, row*25);
if(lvlArray[index] is String) roadHolder.addChild( new DirectBlock(lvlArray[index], col*25, row*25) );
function createBlock(color, xp, yp):void {
var block:Shape = new Shape();
block.graphics.beginFill(color);
block.graphics.drawRect(0,0,25,25);
block.graphics.endFill();
block.x = xp;
block.y = yp;
roadHolder.addChild(block);
note: i do not know how many 'rows' you intend to have and are stored in the array so the row<22 will need adjustment -
Need help loading an external SWF
I'm not very proficient in Flash, so any help will be greatly appreciated. I'm trying to load an external SWF with the following code:
T1_Bttn_BloodCar.onRelease = function() {
t1_images_mc.loadMovie("images/T1_Gallery/BloodCar_SWF/T1_BloodCar.swf");
t1_images_mc._alpha = 0;
It loads the SWF, but doesn't play it correctly when I test it. Here's how the loaded movie is supposed to look:
http://www.theroboteye.com/T1_BloodCar.html
But instead, it plays without the transitions, like this:
http://www.theroboteye.com/TRE2009b.html
I've been trying to figure this out for a few days and have tried adding "this._lockroot = true;" to the SWF I'm trying to load, but I can't get it to play correctly. Can anyone tell me what I'm doing wrong? Thanks in advance.Try using the MovieClipLoader class (loadClip method) instead of the loadMovie method. That way you can have a listener that waits for the movie to be loaded and then pull it into play, assigning actions and properties to it after the fact.
-
URGENT : Please HELP : Loading a first image too slow
Hello,
I want to load an image to save it just before in a JPG format so as to obtain finally a byte[] array of this JPG image result.
So, to do it, I tried to load my Image from different ways but I have always a strange comportement... My problem come from the reading :
First, I use the imageio classes...
FileImageInputStream fiis = new FileImageInputStream(file);
BufferedImage input = ImageIO.read(fiis);
And then, I use the oldest method :
Image image = new ImageIcon(file.getAbsolutePath()).getImage();
BufferedImage input = new BufferedImage(image.getWidth(panel), image.getHeight(panel),BufferedImage.TYPE_INT_RGB);
and also :
Image image = new ImageIcon(file.getAbsolutePath()).getImage();
BufferedImage input = toBufferedImage(picture);
But finally, I understood my problem is that the first time I load an image (no matter the format, JPG, BMP, TIFF... or other) the loading phase is very slow and lasts at least 30 sec. But then, every loading that I do will gonna be really fast. (No more than 1 sec.) It's look like if the first time there was a kind of dinamical alocation or something like that.... but I tried to find some configuration parameters to set it... But without success. :-(
If someone could have an idea to suggest me... it would help me very much.
Thanks in advance for your help,
AnthonyPlease someone can help me ?!? A suggestion ?
I have tried today one more time to resolve this issue... but without success... Anything I do with the loading of an image... by imageio or other ways... it's still the same problem... the first time I load an image, it takes me 40 - 50 sec to load it and after this first load, it is very fast with others... and with every formats. It's not a question of format but of memory allocation, I think... but I'm not sure...
PRECISION : I work with an applet, is there something to configurate to allocate some memories or another thing ?!?
Thanks in advance for your help, I really need it just right now... I have to finish this job extremly fast !!!
Regards,
Anthony -
Use Web API url for loading an external image in a report
Hi there,
I am trying to host an image in a report, which is coming out of a Web API. I am able access the image through a URL in a browser:
https://companytest.com/api/TestFormImage?id=10358&EntityId=6719&imgMetadataName=TestDiagram
Can anyone please help me how to include this in a report ? I have tried to include this as an external image with the URL embedded as a string like:
=string.Format("https://companytest.com/api/TestFormImage?id=10358&EntityId=6719&imgMetadataName=TestDiagram")
NOTE: the output of the Web API is an image of MIME type PNG.
Thanks in advance!
Regards, LaksTo add an external image
In report design view, on the Insert tab, click Image.
On the design surface, click and then drag a box to the desired size of the image.
On the General tab of the Image Properties dialog box, type a name in the
Name text box or accept the default.
(Optional) In the Tooltip text box, type text to display when the user hovers over the image in a report rendered for HTML.
In Select the image source, select External.
For an image on a report server in native mode, type a relative path to the image in the
Use this image box—for example, ../images/image1.jpg.
For an image on a report server in SharePoint integrated mode, or any other Web site, type a full URL to the image in the
Use this image box—for example, http://<SharePointservername>/<site>/Documents/images/image1.jpg.
For more information, see Specifying Paths to External Items (Report Builder and SSRS).
(Optional) Click Size, Visibility, Action, or
Border to set additional properties for the image report item.
Click OK.
Andy Tauber
Data Architect
The Vancouver Clinic
Website | LinkedIn
This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click
"Mark as Answer" and "Vote as Helpful" on posts that help you. This can be beneficial to other community members reading the thread. -
Hello there!
I'm starting to work a lot with Classes, but I'm still reletively new to them. I wrote a "creature" class (which extends Sprite), and I have everything working nicely... except for when it comes to displaying the image of the creature.
In previous programs, I've been able to load external Bitmaps using the Loader class. However, this can only be done from the main timeline in Flash, right? Such as this:
var imgLoader:Loader = new Loader();
imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
imgLoader.load(new URLRequest("001.png"));
function done(evt:Event):void {
addChild(Bitmap(imgLoader.content));
Ideally, what I'd like to do is just have a function within my class. The function would contain the addChild statement, so I could simply do:
var MyCreature:creature = new creature();
MyCreature.loadImage();
However, I would be equally as happy if I could just load the Bitmap and return it from the class. Then I could addChild myself in the main timeline:
var MyCreature:creature = new creature();
addChild(MyCreature.getBitmap());
I've tried putting the Loader code in a function within the creature class, however it isn't working. It didn't return any errors, but it also didn't display anything, despite it containing the addChild statement. Using the trace command, it looks like its getting inside the function, however addChild doesn't do anything. Am I missing something? Is there a better way?
Here's the function in my creature class:
public function loadImage(){
var imgLoader:Loader = new Loader();
imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
imgLoader.load(new URLRequest("001.png"));
function done(evt:Event):void {
trace("It gets to this point just fine");
addChild(Bitmap(imgLoader.content));
Thank you!Sorry! Sure enough, I browse the web for hours, unable to find a solution, post a forum post, and then I find a solution.
http://stackoverflow.com/questions/5036650/as3-addchild-in-a-class
I simply forgot to add the addChild(MyCreature) in the main timeline. Duh. <3 -
Need help loading base64 encoded image.
I've got an applet that saves an image into a database by posting a base64 encoded version of the image to an ASP page. Basically, I convert the image to an array of bytes, then encode it and post it to the page. Now, my problem occurs after I read the base64 string from the database and try to display it. When the application is started up, it is supposed to read the image and load it into the canvas of the applet, but I get a NullPointerException when I call displayImage because the fgImage has -1 width and height. If anyone has done this before and has any hints or tips, that would be great. Otherwise, take a look at my code and see if you can find something wrong. Thanks!
public void loadBase64Image(int[] newPixels) {
System.out.println("loading new image...");
try {
if (newPixels == null) {
byte[] imgPixels = new byte[this.getWidth() * this.getHeight() * 4];
URL loadURL = new URL(fgImgURL);
URLConnection imageCon = loadURL.openConnection();
imageCon.setDoOutput( true );
imageCon.setUseCaches(false);
DataInputStream imageIn = new DataInputStream( imageCon.getInputStream() );
BASE64Decoder decodedImage = new BASE64Decoder();
imgPixels = decodedImage.decodeBuffer(imageIn);
imageIn.close();
int w = this.getWidth();
int h = this.getHeight();
int imgPix[] = new int[w * h];
int index = 0;
for(int y=0; y<imgPix.length;y++){
imgPix[y] = imgPixels[4*y]
| (imgPixels[4*y + 1] >> 8)
| (imgPixels[4*y + 2] >> 16)
| (imgPixels[4*y + 3] >> 24);
imgMemSrc = new MemoryImageSource(w, h, imgPix, 0, w);
else
imgMemSrc = new MemoryImageSource(this.getWidth(),this.getHeight(),newPixels,0,this.getWidth());
// Update the fgImage to the current OSC.
if (fgImage != null) fgImage.flush();
fgImage = Toolkit.getDefaultToolkit().createImage(imgMemSrc);
displayImage(fgImage, this.getWidth(), this.getHeight());
catch (Exception e){
System.out.println("BASE64 LOAD ERROR (" + e.getClass() + ": " + e.getMessage() + ")");Docs for URLConnection
"A URL connection can be used for input and/or output. Set the DoInput flag to true if you intend to use the URL connection for input, false if not. The default is true unless DoOutput is explicitly set to true, in which case DoInput defaults to false."
You have setDoOutput(true), so doInput is by default set to false according to the docs. I would make the change to also setDoInput(true) as well and see if it works.
public void loadBase64Image(int[] newPixels) {
System.out.println("loading new image...");
try {
if (newPixels == null) {
byte[] imgPixels = new byte[this.getWidth() * this.getHeight() * 4];
URL loadURL = new URL(fgImgURL);
URLConnection imageCon = loadURL.openConnection();
imageCon.setDoOutput( true );
imageCon.setDoInput( true ); // Make sure you add this line
imageCon.setUseCaches(false);
DataInputStream imageIn = new DataInputStream( imageCon.getInputStream() );
BASE64Decoder decodedImage = new BASE64Decoder();
imgPixels = decodedImage.decodeBuffer(imageIn);
imageIn.close();
int w = this.getWidth();
int h = this.getHeight();
int imgPix[] = new int[w * h];
int index = 0;
for(int y=0; y<imgPix.length;y++){
imgPix[y] = imgPixels[4*y] | (imgPixels[4*y + 1] >> 8) | (imgPixels[4*y + 2] >> 16) | (imgPixels[4*y + 3] >> 24);
imgMemSrc = new MemoryImageSource(w, h, imgPix, 0, w);
else
imgMemSrc = new MemoryImageSource(this.getWidth(),this.getHeight(),newPixels,0,this.getWidth());
// Update the fgImage to the current OSC.
if (fgImage != null)
fgImage.flush();
fgImage = Toolkit.getDefaultToolkit().createImage(imgMemSrc);
displayImage(fgImage, this.getWidth(), this.getHeight());
catch (Exception e){
System.out.println("BASE64 LOAD ERROR (" + e.getClass() + ": " + e.getMessage() + ")"); -
Loading an external image (from file system) to fla library as MovieClip symbol.
Hi everyone,
I am new to actionscript and Flash.
I have been working on code updation project wherein initially we had an image and text as movieclips in fla library. The image and the text are read by the actionscript program which then creates an animation.
For Example:
// Picture
// _imageMC: Name of the Movie Clip in the libary which
// contains the picture.
var _imageMC:String = "polaroid";
This is later on used by another actionscript class as follows to finally create the animation.
var _mcPolaroid:MovieClip = this._mcBg.attachMovie(this._polaroid, "polaroid_mc", this._mcBg.getNextHighestDepth());
Now the problem here is when one needs to update the image or text, one needs to go and open the fla file andmanually change the image attached to the movieClip (polaroid).
I want to ease the updation process by giving the url of the image in an XML file. Read the image url from the xml and load this image in the library of the fla as movieclip. This, i think, will result in less code change and improve the updation of the final animation image.
The problem i am facing is not been able to figure out how can i change the image (after fetching its URL) to a movieclip and then load it in the library?
Thank you kindly in advance,
VarunThis is the AS3 forum and you are posting with regards to AS2 code. Try posting in the AS2 forum...
http://forums.adobe.com/community/flash/flash_actionscript
As for the solution you seem to want. You cannot dynamically add something to the library during runtime. To add an image during runtime you would need to use the MovieClip.loadMovie() or MovieClipLoader.loadClip() methods. You could have the movieclip pre-arranged in the library, but to add the image dynamically via xml information you need to load it into a movieclip, not the library. -
Hi everyone,
I am new to actionscript and Flash.
I have been working on code updation project wherein initially we had an image and text as movieclips in fla library. The image and the text are read by the actionscript program which then creates an animation.
For Example:
// Picture
// _imageMC: Name of the Movie Clip in the libary which
// contains the picture.
var _imageMC:String = "polaroid";
This is later on used by another actionscript class as follows to finally create the animation.
var _mcPolaroid:MovieClip = this._mcBg.attachMovie(this._polaroid, "polaroid_mc", this._mcBg.getNextHighestDepth());
Now the problem here is when one needs to update the image or text, one needs to go and open the fla file andmanually change the image attached to the movieClip (polaroid).
I want to ease the updation process by giving the url of the image in an XML file. Read the image url from the xml and load this image in the library of the fla as movieclip. This, i think, will result in less code change and improve the updation of the final animation image.
The problem i am facing is not been able to figure out how can i change the image (after fetching its URL) to a movieclip and then load it in the library?
Thank you kindly in advance,
VarunThe following was my attempt: (i created a new MovieClip)
this.createEmptyMovieClip("polaroidTest", this.getNextHighestDepth());
loadMovie("imagefile.jpg", polaroidTest)
var _imageMC:String = "polaroidTest";
This mentioned variable _imageMC is read by a MovieClip class(self created as follows)
/////////////////////////////// CODE STARTS //////////////////////////////////////
class as.MovieClip.MovieClipPolaroid {
private var _mcTarget:MovieClip;
private var _polaroid:String;
private var _mcBg:MovieClip;
private var _rmcBg:MovieClip;
private var _w:Number;
private var _h:Number;
private var _xPosition:Number;
private var _yPosition:Number;
private var _border:Number;
* Constructor
function MovieClipPolaroid(mcTarget:MovieClip, polaroid:String) {
this._mcTarget = mcTarget;
this._polaroid = polaroid;
init();
* initialise the polaroid movieclip and reflecting it
private function init():Void {
this._border = 10;
this.initSize();
this.setPosition(48,35);
this.createBackground();
var _mcPolaroid:MovieClip = this._mcBg.attachMovie(this._polaroid, "polaroid_mc", this._mcBg.getNextHighestDepth());
_mcPolaroid._x = _border;
_mcPolaroid._y = _border;
var _rmcPolaroid:MovieClip=this._rmcBg.attachMovie(this._polaroid,"rpolaroid_mc", this._rmcBg.getNextHighestDepth());
_rmcPolaroid._yscale *=-1;
_rmcPolaroid._y = _rmcPolaroid._y + _h + _border ;
_rmcPolaroid._x =_border;
* create the background for the polaroid
private function createBackground():Void {
this._mcBg = _mcTarget.createEmptyMovieClip("target_mc",_mcTarget.getNextHighestDepth());
this._rmcBg = _mcTarget.createEmptyMovieClip("rTarget_mc", _mcTarget.getNextHighestDepth());
fill(_mcBg,_w+2*_border,_h+2*_border,100);
fill(_rmcBg,_w+2*_border,_h+2*_border,10);
placeBg(_mcBg,_w+2*_border,_yPosition);
placeBg(_rmcBg,_w+2*_border,_h+2*_border+_yPosition);
* position the background
private function placeBg(mc:MovieClip,w:Number,h:Number) : Void {
mc._x = Stage.width - w - _xPosition;
mc._y = h;
* paint the backgound
private function fill(mc:MovieClip,w:Number,h:Number, a:Number): Void {
mc.beginFill(0xFFFFFF);
mc.moveTo(0, 0);
mc.lineTo(w, 0);
mc.lineTo(w, h);
mc.lineTo(0, h);
mc.lineTo(0, 0);
mc.endFill();
mc._alpha=a;
* init the size of the polaroid
private function initSize():Void {
var mc:MovieClip =_mcTarget.createEmptyMovieClip("mc",_mcTarget.getNextHighestDepth());
mc.attachMovie(this._polaroid,"polaroid_mc", _mcTarget.getNextHighestDepth());
this._h = mc._height;
this._w = mc._width;
removeMovieClip(mc);
mc = null;
* sets the position of the polaroid
public function setPosition(xPos:Number,yPos:Number):Void {
this._xPosition = xPos;
this._yPosition = yPos;
* moving in
public function moveIn():Tween {
var mc:MovieClip = this._mcTarget;
mc._visible=true;
var tween:Tween = new Tween(mc, "_x", Strong.easeOut, 0, 0, 1, true);
var tween:Tween = new Tween(mc, "_y", Strong.easeOut, 200, 0, 1, true);
var tween:Tween = new Tween(mc, "_xscale", Strong.easeOut, 30, 100, 1, true);
var tween:Tween = new Tween(mc, "_yscale", Strong.easeOut, 30, 100, 1, true);
var tween:Tween = new Tween(mc, "_alpha", Strong.easeOut, 0, 100, 1, true);
return tween;
* moving in
public function moveOut():Tween {
var mc:MovieClip = this._mcTarget;
var tween:Tween = new Tween(mc, "_alpha", Strong.easeIn, 99, 0, 1, true);
var tween:Tween = new Tween(mc, "_x", Strong.easeIn,0, 1000, 1, true);
var tween:Tween = new Tween(mc, "_y", Strong.easeIn, 0, -50, 1, true);
var tween:Tween = new Tween(mc, "_xscale", Strong.easeIn, 100, 50, 1, true);
var tween:Tween = new Tween(mc, "_yscale", Strong.easeIn, 100, 50, 1, true);
return tween;
/////////////////////////////// CODE ENDS ///////////////////////////////////////
As in the current case, the name of the movieclip which has the image (originally polaroid) is being read through the variable _imageMC which we hadd given the value "polaroidTest".
The animation shows no image even when i have inserted the correct url (i m sure this step isn't wrong).
Any clues? -
Loading multiple external jpgs...
I'm trying to go through a for loop, create a movieclip for each database entry, add the image by url stored. The problem is the code I have only does the last image. I know it's because something is not incrementing and they all have the same name. Do I need to increment the name of my loader? Holder or what?
var resultsLength:Number = result.serverInfo.initialData.length;
for(var i:uint = 0; i < resultsLength; i++){
var thisClip:MovieClip = new ProductBox();
cleanse_mc.addChild(thisClip);
thisClip.x = currentX;
thisClip.y = currentY;
currentX += moveX;
// populate image
var thumbLoader:Loader;
var holder:MovieClip = new MovieClip();
thumbLoader = new Loader();
var thisImage:String = String(result.serverInfo.initialData[i][14]);
var thumbRequest:URLRequest = new URLRequest(thisImage);
thumbLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, introCompleteHandler);
thumbLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, introProgressHandler);
thumbLoader.load(thumbRequest);
function introCompleteHandler(loadEvent:Event){
var image:Bitmap = (Bitmap)(loadEvent.target.content);
thisClip.addChild(holder);
holder.addChild(image);no, something that would preserve all you movieclips/positions while you're waiting for image loading to complete:
var resultsLength:Number = result.serverInfo.initialData.length;
var i:unit=0;
var thisClip:MovieClip();
loadF();
function loadF(){
thisClip = new ProductBox();
cleanse_mc.addChild(thisClip);
thisClip.x = currentX;
thisClip.y = currentY;
currentX += moveX;
// populate image
var thumbLoader:Loader;
var holder:MovieClip = new MovieClip();
thumbLoader = new Loader();
var thisImage:String = String(result.serverInfo.initialData[i][14]);
var thumbRequest:URLRequest = new URLRequest(thisImage);
thumbLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, introCompleteHandler);
thumbLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, introProgressHandler);
thumbLoader.load(thumbRequest);
function introCompleteHandler(loadEvent:Event){
var image:Bitmap = (Bitmap)(loadEvent.target.content);
thisClip.addChild(holder);
holder.addChild(image);
i++;
if(i<resultsLength ){
loadF() -
Need help loading multiple movie clips.
Hello forum members,
I've run into a bit of an irritating problem and perhaps
someone can clue me in to the answer.
I'm creating a SWF which uses loadMovie (I've also tried
creating a MovieClipLoader instance and using instance.loadClip) to
bring in 2 other SWFs.
See below AS in first couple frames of main movie's
time-line:
First movie:
this.createEmptyMovieClip("mcToolbar", 10);
with (mcToolbar)
_x=8;
_y=68;
loadMovie("toolbar.swf",mcToolbar);
Second movie:
this.createEmptyMovieClip("mcWindow", 11);
with (mcToolbar)
_x=500;
_y=60;
loadMovie("textwindow.swf",mcWindow);
This works great when opening up my main SWF in Flash Player
and when viewing the movie in the published HTML web page.
However, I'm using FlashObject to load my main movie to get
around that annoying "Click to activate this control" thing.
When viewing this version of the web page with my main SWF
being loaded, I see the SWF load, then the first loadMovie
loads....THEN the first loadMovie disappears and the second
loadMovie loads and appears at the wrong X and Y coordinates.
Any ideas?Ok, I know replying to my own post is odd on some forums, but
anyhow:
I've done some further testing and find that FlashObject
isn't the problem.
Looking at the AS code above, it is clear that the SWFs to be
loaded must be in the same folder as the HTML web-page.
However, my intent is that these small SWFs that are being
loaded in by the main SWF will be shared by many other movies,
therefore I'd like to stick them (the physical SWF files) closer to
the root of the site (e.g. SiteFoler->flash).
I see that my problem rears its ugly head when I try to
reference these movies in my main flash movie as follows:
First movie:
this.createEmptyMovieClip("mcToolbar", 10);
with (mcToolbar)
_x=8;
_y=68;
loadMovie("../../../flash/toolbar.swf",mcToolbar);
Second movie:
this.createEmptyMovieClip("mcWindow", 11);
with (mcToolbar)
_x=500;
_y=60;
loadMovie("../../../flash/textwindow.swf",mcWindow);
In the example above, my HTML page is 3 folders deep whereas
the movies I'm loading in are 1 folder deep in the folder labeled
"flash".
By doing it in this manner, I get the problems I described
above (first movie loads then disappears and second movie loads in
wrong position).
Any ideas as to why the physical location of the SWFs being
pulled in is causing this problem? I'd like to try to avoid copying
the SWFs to each place their being refrenced from as that could be
a major maintenance headace.
Thanks,
Ben -
AS3 Load external image and add multiple instances to mcs
Hi,
Is there any way to load an external image and add it to more than one movie clip?
Thanks,
Chris McLaughlinHi kglad,
I was loading a larger jpeg to which I was applying 20 different masks so using the bitmapdata class to create duplicates was the best solution.
It took me some time to wrap my head around it, but all is well.
Thanks for pointing me in the right direction.
Best regards,
Chris -
Help with AS3, loading multiple files into a movieclip in specific order in scrollbar
Hello! I am in need of some advice. We are trying to build a site with these features:
Our site will be built in Actionscript 3.
1. A navigation menu that, when a button is clicked, will scroll the site quickly to a specific Y position using swfaddress.
2. The entire site is controlled by a flash scroll bar, which will be scrolling a single movieclip.
2A. The movieclip will load content corresponding to the navigation categories, all which is organized into zipped files (using this to extract the contents of each section, example: about.zip for the about section of the site)
2B. The movieclip will load multiple zipped files one by one that correspond to the navigation, in order, making the site appear to be very tall.
**What we are in need of is understanding how to load multiple zipped files into a movie clip, in a specific order, and having them scroll between one another through the navigation. The separate navigation categories can be in movieclips instead of zipped files if that is easier.
Here is a reference of something that works like this: http://swfc-shanghai.com/#/about/Hello kglad! I have set aside the idea of using zipped files, and am now just using multiple external swfs that I'd like to load into the movieclip in a specific order. Any thoughts?
I'm new to AS3, and I'm attempting to create a scrolling movieclip that will load multiple external files, in order, into that movieclip. I'm using XML as well. At this point, nothing is loading into my movieclip (contentMain) and it's a bit frustrating! Thank you for your help!
Current error: 1180: Call to a possibly undefined method load.
AS3:
//XML Loader
var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.load ("master.xml");
myXML.onLoad =function(sucess) {
if (sucess) {
contentMain.loadAll();{
load("1_Overview.swf")
load("2_Webcam.swf")
load("3_Twounion.swf")
load("4_Oneunion.swf")
load("5_Retail.swf")
load("6_Nearby.swf")
load("7_Courtyard.swf")
load("8_Map.swf")
load("9_Conference.swf")
load("10_News.swf")
load("11_Sustainability.swf")
load("12_Contact.swf")
addEventListener("complete",onLoad)
onLoad();{
//load all
}else {
trace("ERROR LOADING XML");
Maybe you are looking for
-
One more nugget: Chart zoom with the "Mouse Over" effect
Hello all. Just read my signature first, it might explain a lot. I do not intend to compete with Darren and I don't think this "nugget" (at least it supposed to be one) will amaze any of the LV veterans and this forum is rich of them. But maybe it wi
-
Problems (bugs) with Project Explorer LV8.5.1 Windows Vista 64bit
Helo all, I am using Windows Vista 64bit with all updates and service packs on an ASUS G1 dual core 4gig memory. After writing code for a while I find that I cannot execute my top level vi from the project explorer. I can run the vi from outside th
-
How do i get the music off my ipod to my new mac?
How do i get the 3.1 gb of music off the ipod with out paying (i am a kid) If i dont get this i will have to synk and loose all my music (original pc in landfill) Thanks ahead of time
-
HT5622 ive verified my email information and my apple id but still cant get into my phone
i cant get into my phone even tho i put in all the correct info
-
How to close a running exe through java code
hai friends, i need to close a running exe file through code... i tried Runtime r; Process p; try { r = Runtime.getRuntime(); p=r.exec("d:\\aaa"); } catch (IOException ex) p.destroy();but its not closing the applicatio