Problem Loading In SWF Into Loader Object
Hi,
I need help (typical tight deadline so any help appreciated).
I have a Flash movie and on Frame 1 is my preloader, and on Frame 2 is a movieclip which has one frame within it.
The Movieclip then does some animation via AS3 and then creates a loader object and adds it to the display list. The AS3 code then attempts to load another SWF into the loader object (the SWF is in the same folder as the parent SWF).
I have a preloader that checks the loading of the loader object and that is running fine, but the SWF just doesn't load?
I don't know if this has anything to do with the line "var req:URLRequest = new URLRequest("Home.swf");" and the fact that im loading the SWF into the loader object which is within a movieclip?
My code for creating the loader object is as follows....
Attach Code
// First request the file
var req:URLRequest = new URLRequest("Home.swf");
// Next create a loader object
var loader:Loader = new Loader();
// Then tell the loader object to load the requested file
loader.load(req);
// Position the loader object
loader.x = 14;
loader.y = 14;
loader.width = 731;
loader.height = 451;
loader.alpha = 1;
// Now add the loader object to the stage
addChild(loader);
// Turn loading bar visibility on
mcLoadingBar2.visible = true;
mcLoadingBarBorder.visible = true;
loadingBar2.visible = true;
// Check the loading progress of the requested file (the data is stored in 'contentLoaderInfo')
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, checkProgress);
// Run this event handler function every time the event listener is triggered
function checkProgress(p:ProgressEvent):void
{
var percent:int = (p.currentTarget.bytesLoaded / p.currentTarget.bytesTotal) * 100;
loadingBar2.text = String(percent + '%');
mcLoadingBar2.width = percent;
if(percent == 100)
{
removeChild(mcLoadingBar2);
removeChild(mcLoadingBarBorder);
removeChild(loadingBar2);
loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, checkProgress);
}
}
Adobe > ActionScript 3
Posted on: 02/08/2008 03:32:23 AM
View Complete Forum Thread with Replies
Sponsored Links:
Problem Loading In SWF Into Loader Object
Hi,
I need help (typical tight deadline so any help appreciated).
I have a Flash movie and on Frame 1 is my preloader, and on Frame 2 is a movieclip which has one frame within it.
The Movieclip then does some animation via AS3 and then creates a loader object and adds it to the display list. The AS3 code then attempts to load another SWF into the loader object (the SWF is in the same folder as the parent SWF).
I have a preloader that checks the loading of the loader object and that is running fine, but the SWF just doesn't load?
I don't know if this has anything to do with the line "var req:URLRequest = new URLRequest("Home.swf");" and the fact that im loading the SWF into the loader object which is within a movieclip?
My code for creating the loader object is as follows....
Code:
// First request the file
var req:URLRequest = new URLRequest("Home.swf");
// Next create a loader object
var loader:Loader = new Loader();
// Then tell the loader object to load the requested file
loader.load(req);
// Position the loader object
loader.x = 14;
loader.y = 14;
loader.width = 731;
loader.height = 451;
loader.alpha = 1;
// Now add the loader object to the stage
addChild(loader);
// Turn loading bar visibility on
mcLoadingBar2.visible = true;
mcLoadingBarBorder.visible = true;
loadingBar2.visible = true;
// Check the loading progress of the requested file (the data is stored in 'contentLoaderInfo')
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, checkProgress);
// Run this event handler function every time the event listener is triggered
function checkProgress(p:ProgressEvent):void
{
var percent:int = (p.currentTarget.bytesLoaded / p.currentTarget.bytesTotal) * 100;
loadingBar2.text = String(percent + '%');
mcLoadingBar2.width = percent;
if(percent == 100)
{
removeChild(mcLoadingBar2);
removeChild(mcLoadingBarBorder);
removeChild(loadingBar2);
loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, checkProgress);
}
}
View Replies !
View Related
Object Loader Loaded And Not Loading
hi, fancy title eh? hehe
anyhow, got a Q...
I loaded 5 JPG's into specific locations of an array via the URLRequest. So now when I trace my array:
ActionScript Code:
trace(getXMLlinkArray);
//[object Loader],[object Loader],[object Loader],,,,,,,,,,,,,,,,,[object Loader],[object Loader]
then later I'm looking to see if an index in an array (i.e., 10) is null and if it is, then I load it with another image. However, if NOT, then I want to take the existing [object Loader] and shove it into another array filled with sprites.
ActionScript Code:
var xmlImgHolder:Sprite;
var imgRotationHolder:Sprite;
var spriteHolderArray:Array = new Array();
var xmlImgHolder:Number = 0;
xmlImgHolder = new Sprite();
xmlImgHolder.addChild(getXMLlinksArray[imgHideRight]);
spriteHolderArray.splice(imgHideRight,1,xmlImgHolder);
imgRotationHolder.addChild(spriteHolderArray[imgHideRight]);
note: imgRotationHolder holds 5 xmlImgHolder's
THE PROBLEM: when I scan getXMLlinksArray and see that its NOT null, and i try to addChil to xmlImgHolder and then to spriteHolderArray, I just get a blank space.
The debuger is showing that spriteHolderArray contains some loader info and the appropriate URL up until I load it with the existing loader from getXMLlinksArray. Then it says it doesn't have any conentedLoadedInfo. Any ideas?
View Replies !
View Related
Problem Loading SWF Into Loader Object
Hi,
I need help (typical tight deadline so any help appreciated).
I have a Flash movie and on Frame 1 is my preloader, and on Frame 2 is a movieclip which has one frame within it.
The Movieclip then does some animation via AS3 and then creates a loader object and adds it to the display list. The AS3 code then attempts to load another SWF into the loader object (the SWF is in the same folder as the parent SWF).
I have a preloader that checks the loading of the loader object and that is running fine, but the SWF just doesn't load?
I don't know if this has anything to do with the line "var req:URLRequest = new URLRequest("Home.swf");" and the fact that im loading the SWF into the loader object which is within a movieclip?
My code for creating the loader object is as follows....
Code:
// First request the file
var req:URLRequest = new URLRequest("Home.swf");
// Next create a loader object
var loader:Loader = new Loader();
// Then tell the loader object to load the requested file
loader.load(req);
// Position the loader object
loader.x = 14;
loader.y = 14;
loader.width = 731;
loader.height = 451;
loader.alpha = 1;
// Now add the loader object to the stage
addChild(loader);
// Turn loading bar visibility on
mcLoadingBar2.visible = true;
mcLoadingBarBorder.visible = true;
loadingBar2.visible = true;
// Check the loading progress of the requested file (the data is stored in 'contentLoaderInfo')
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, checkProgress);
// Run this event handler function every time the event listener is triggered
function checkProgress(p:ProgressEvent):void
{
var percent:int = (p.currentTarget.bytesLoaded / p.currentTarget.bytesTotal) * 100;
loadingBar2.text = String(percent + '%');
mcLoadingBar2.width = percent;
if(percent == 100)
{
removeChild(mcLoadingBar2);
removeChild(mcLoadingBarBorder);
removeChild(loadingBar2);
loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, checkProgress);
}
}
View Replies !
View Related
Simple Loader Fails When Loading In An .swf Containing The Loader.
Sorry for the complicated topic. I got a .swf that loads in other .swfs. Rather than figuring out how to make a loader for loading .swfs I thought I'd just use a simple loader in the .swf I'm loading.
However, it doesn't work. It starts fully loaded but doesn't finish. Heres the AS:
ActionScript Code:
_root.stop();
PercentLoaded = _root.getBytesLoaded()/_root.getBytesTotal()*100;
if (PercentLoaded != 100) {
bar._xscale = PercentLoaded;
} else {
_root.play();
}
Anyone got a clue? Or would anyone be willing to point me in the direction for a very simple .swf loader.
thanks!
View Replies !
View Related
Simple Loader Fails When Loading In An .swf Containing The Loader.
Sorry for the complicated topic. I got a .swf that loads in other .swfs. Rather than figuring out how to make a loader for loading .swfs I thought I'd just use a simple loader in the .swf I'm loading.
However, it doesn't work. It starts fully loaded but doesn't finish. Heres the AS:
ActionScript Code:
_root.stop();PercentLoaded = _root.getBytesLoaded()/_root.getBytesTotal()*100;if (PercentLoaded != 100) { bar._xscale = PercentLoaded;} else { _root.play();}
Anyone got a clue? Or would anyone be willing to point me in the direction for a very simple .swf loader.
thanks!
View Replies !
View Related
Loader Object For FLV, SWF
I'm trying to make a movie player of a sort that loads all the things in a folder and plays them one by one. This folder can contain images, flvs and swfs. Is this possible ? Anyone having some code or project lying around doing something similar, need help
View Replies !
View Related
[loader Object]
hey, i'm using a *stupid* loader that won't load certain pictures. yes, the path is correct. and yes, it will load other pictures in the same dir with very similar properties.
has anyone else run into this problem before???
View Replies !
View Related
Reusing Loader Object
Hi there
I am having some troubles with adding the same Loading object to the stage more than just one time. I am working on a project, where I need to use the same image several times at once. No problems loading the images, but I only want to load the one time off course!
Loading the images:
Code:
function loadImage():void
{
var imageLoader:Loader = new Loader();
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageOnLoadHandler);
imageLoader.load(new URLRequest(urlArray[loadImageCounter]));
imageArray[loadImageCounter] = imageLoader;
}
Adding the images to the stage:
Code:
function addImagesToStage():void
{
for (var i:int = 0; i < imageArray.length; i++)
{
var imgDaysLoader:Loader = imageArray[i];
var imgHoursLoader:Loader = imageArray[i];
imgDaysLoader.x = 0;
imgHoursLoader.x = 200;
addChild(imgDaysLoader);
addChild(imgHoursLoader);
}
}
View Replies !
View Related
ButtonMode On Loader Object?
I'm using XML and a loader to dynamically load images (client logos) into my tesimonials page.
I want it so that when the user clicks on the image loaded into the loader, it takes them to the client's website.
Well, I have the link/click functionality working great...but there is no hand cursor when the user hovers over the image.....how can I set it so the loader shows the hand cursor when the user is over it???
I've already tried casting it as a MovieClip, but that throws me errors too...
View Replies !
View Related
[object Loader] Not Reloading
hi, I have an XML image that I loaded into a sprite and then the sprite into an array, I'm trying to now retrieve the [object Loader] that is in the original array, and display it. however, I keep getting a blank space instead. Is there any particular way to do this?
View Replies !
View Related
Loader Object Hell
Not sure why, but I'm having trouble grasping the loader object's real functionality.
I understand images are children of the object and the object is a child of a sprite, but I'm still having problems and hopefully someone can walk me through this.
On my stage I have six sprites and in them I've loaded images. What I need to do is randomly fade one out and fade another in its place. The images need to fade completely out before fading in again.
I've got a timer setup for 3 seconds between image changes and in that time I'm having Flash choose the next sprite to replace and preload the image. The images are all very small so 3 seconds is long enough to preload.
My logic is this:
- choose a random sprite
- load the image
- timer elapses
- fade out sprite
- add loader to sprite
- fade in sprite
- repeat
How do I do this? Do I need two loaders for each sprite or just two for the whole movie?
Any help is appreciated.
:grimey
View Replies !
View Related
Object Loader Info
Hi--
I know I've done this before, but am having brain freeze or something and can't get it to work.
I've got a few spites on stage that are created dynamically and live in an array. I'm rotating images through these sprites and now need to know which image is in a sprite when clicked. My code:
loading the images:
Code:
var loader:Loader = new Loader();
var request:URLRequest = new URLRequest(imgPath+"1.jpg");
loader.load(request);
spriteArray[1].addChild(loader);
click function:
Code:
function click1(e:Event) {
trace (spriteArray[1].getChildAt(0).content);
}
my click1 function above returns [object bitmap]. I'd like something like to see "1.jpg". What am I missing?
Thanks!
:grimey
View Replies !
View Related
Loader Object Reference From MovieClip
Good afternoon coders. I'm trying to reference a loader Object on the maintime line from within a MovieClip. More clearly, when I press one of my buttons (myCars or myVideos) I need my transition movieclip named container to play. Once the movieclip reaches a particular frame, I need the code in that frame to run.
First, here's the code on the main timeline:
import flash.display.*;
var my_loader:Loader = new Loader();
addChild(my_loader);
var container:blue=new blue();
container.name = "myContainer";
container.x=10.0;
container.y=74.0;
this.addChild(container);
var lastLoaded:String;
myVideos.addEventListener(MouseEvent.MOUSE_DOWN, loadTheBaby);
myCars.addEventListener(MouseEvent.MOUSE_DOWN, loadTheCars);
function loadTheBaby (e:MouseEvent):void{
if(e.currentTarget.name !=lastLoaded){
lastLoaded=e.currentTarget.name;
container.gotoAndPlay("motivate");
}
}
function loadTheCars (e:MouseEvent):void{
if(e.currentTarget.name !=lastLoaded){
lastLoaded=e.currentTarget.name;
container.gotoAndPlay("motivate");
}
}
Now, here's the code I need to run when the movieclip named container reaches a certain frame:
stop();
//lastLoaded=e.currentTarget.name;
my_loader.load(new URLRequest(lastLoaded+".swf"));
my_loader.contentLoaderInfo.addEventListener(Progr essEvent.PROGRESS, loop);
my_loader.contentLoaderInfo.addEventListener(Event .COMPLETE, done);
function loop(e:ProgressEvent):void
{
var perc:Number = e.bytesLoaded / e.bytesTotal;
percent.text = Math.ceil(perc*100).toString();
}
function done(e:Event):void
{
removeChildAt(0);
percent = null;
addChild(my_loader);
gotoAndPlay("closeup");
}
Here are the error messages:
1120: Access of undefined property my_loader.
1120: Access of undefined property lastLoaded.
the variable lastLoaded is on the main timeline, and the loader Object my_loader is also on the main timeline. So, I believe I need to reference the loader Object and the lastLoaded variable on the main timeline from within a movieclip. I tried root.my_loader; I tried parent.my_loader to no avail. I even tried to put the loader object and the lastLoaded var in the movieclip and ran into a laundry list of errors. Is there a new way to access objects and variables on the main timeline from within a movieclip? Please steer me in the right diirection. Thanks for reading.
xFLASHSTUDENTx
View Replies !
View Related
Dragging A Loader Object With StartDrag()
Is it possible to drag a Loader object with startDrag()? I have a dynamically loaded image I'm trying to make dragable. I get a "1061: Call to a possibly undefined method startDrag through a reference with static type flash.display:Loader." error. I assume it's because I can only drag MovieClips and Sprites.
ActionScript Code:
package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.Event;
public class PhotoLoader extends MovieClip {
public var photoDownloader:Loader = new Loader();
public function PhotoLoader (event:Event):void {
var url:String = "./files/" + fileReference.name;
var photoUrl:URLRequest=new URLRequest(url);
statusArea.text= fileReference.name + " loaded.";
photoDownloader.mask = photoHolder;
photoDownloader.load (photoUrl);
addChild (photoDownloader);
}
private function onMouseDown (event:MouseEvent):void {
stage.addEventListener (MouseEvent.MOUSE_UP, onMouseUp);
photoDownloader.startDrag ();
}
private function onMouseUp (event:MouseEvent):void {
stage.removeEventListener (MouseEvent.MOUSE_UP, onMouseUp);
photoDownloader.stopDrag ();
}
}
}
View Replies !
View Related
Adding Properties To A Loader Object
In theory a loader object inherits "object" for which you can add properties dynamically.
But you can't do that with a loader object...
Is this true?
//try to add a property "goobers" to loader object...
var pictLdr:Loader = new Loader();
var pictURL:String = "banana.jpg"
var pictURLReq:URLRequest = new URLRequest(pictURL);
pictLdr.goobers="goobers" //this fails
pictLdr.load(pictURLReq);
this.addChild(pictLdr);
View Replies !
View Related
How To Reference Loader Object Through Listener?
How do I reference Loader object through a listener?
for example:
ActionScript Code:
function Main():void{ var loader:Loader = new Loader(); loader.load(new URLRequest("image.jpg")); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadCompleted);}function onLoadCompleted(e:Event):void{ //I have no access to loader here. //How would i access it? So i could reposition, rotate, etc. //ie. loader.x = 50;}
View Replies !
View Related
How Do I Make A Loader Object Into A Button?
I want to make a Loader object become a button. I am not sure how to give the Loader object button properties.
this is where I'm at:
Code:
var myArray:Array = new Array('zero.swf','one.swf','two.swf','three.swf');
for (var i:uint=0; i<myArray.length; i++) {
var contentInitializeLoader:Loader = new Loader();
contentInitializeLoader.name='containerMC_'+(i);
myContent.addChild(contentInitializeLoader);
urlString=myArray[i];
contentInitializeLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, contentInitializeLoaded);
contentInitializeLoader.load(new URLRequest(urlString));
function contentInitializeLoaded(e:Event):void {
trace('loaded');
var theMC=myContent.getChildAt(0);
// make theMC become a button
}
in AS 2, I would have done it like this:
Code:
theMC.onPress=function(){
trace(this.name);
}
thanks for any help.
Aubrey
View Replies !
View Related
Loader Object Reference From MovieClip
Good afternoon coders. I'm trying to reference a loader Object on the maintime line from within a MovieClip. More clearly, when I press one of my buttons (myCars or myVideos) I need my transition movieclip named container to play. Once the movieclip reaches a particular frame, I need the code in that frame to run.
First, here's the code on the main timeline:
import flash.display.*;
var my_loader:Loader = new Loader();
addChild(my_loader);
var container:blue=new blue();
container.name = "myContainer";
container.x=10.0;
container.y=74.0;
this.addChild(container);
var lastLoaded:String;
myVideos.addEventListener(MouseEvent.MOUSE_DOWN, loadTheBaby);
myCars.addEventListener(MouseEvent.MOUSE_DOWN, loadTheCars);
function loadTheBaby (e:MouseEvent):void{
if(e.currentTarget.name !=lastLoaded){
lastLoaded=e.currentTarget.name;
container.gotoAndPlay("motivate");
}
}
function loadTheCars (e:MouseEvent):void{
if(e.currentTarget.name !=lastLoaded){
lastLoaded=e.currentTarget.name;
container.gotoAndPlay("motivate");
}
}
Now, here's the code I need to run when the movieclip named container reaches a certain frame:
stop();
//lastLoaded=e.currentTarget.name;
my_loader.load(new URLRequest(lastLoaded+".swf"));
my_loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);
my_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
function loop(e:ProgressEvent):void
{
var perc:Number = e.bytesLoaded / e.bytesTotal;
percent.text = Math.ceil(perc*100).toString();
}
function done(e:Event):void
{
removeChildAt(0);
percent = null;
addChild(my_loader);
gotoAndPlay("closeup");
}
Here are the error messages:
1120: Access of undefined property my_loader.
1120: Access of undefined property lastLoaded.
the variable lastLoaded is on the main timeline, and the loader Object my_loader is also on the main timeline. So, I believe I need to reference the loader Object and the lastLoaded variable on the main timeline from within a movieclip. I tried root.my_loader; I tried parent.my_loader to no avail. I even tried to put the loader object and the lastLoaded var in the movieclip and ran into a laundry list of errors. Is there a new way to access objects and variables on the main timeline from within a movieclip? Please steer me in the right diirection. Thanks for reading.
xFLASHSTUDENTx
View Replies !
View Related
How/may I Duplicate Or Clone The Contents Of A Loader Object?
I want to load some .swf files using the Loader class. I'm all set with that and got the image on screen but I wish to have multiple instances of it. Do I have to reload one for each that I intent on using?
For example say I'm attempting to load a power up's graphic from an .swf (i'll call it ex.swf). I load it and then put the image I loaded into the power up. But then I also want to have another power up of the same type somewhere else, and I want to use that same graphic. Neither adding the loaded ex.swf's contents or simply assigning the contents to a child of the power up will work obviously. So do I have to load a new copy every single time i want a new one, or can I just clone/duplicate the contents?
Elsewise, is there another way I should be doing this? I mean I know it must be common for games to have 100's of copies of the same graphic being used by different things, yet If I try to preload the amount I'd need it's not exactly flexibly and if I load them as I need them it seems bad practice.. i dunno, let me know what you guys do,
Thanks,
Bobby
View Replies !
View Related
Duplicate Image Loaded Into Loader Object
I realize that I have to use the Loader object to load an external image. The problem I am having with the loader Object is that it doesn't support the addChild methods. Please correct me if I'm wrong. An example.
var sprite:Sprite = new Square(); //imagine a square class that draws a Square
var loader:Loader = new Loader("pic.jpg");
loader.addChild(sprite); //gives an error
//supposedly because the Loader object can only have one child which is pic.jpg
I am in a situation where I want to duplicate the picture that I have loaded into the Loader object, so I can have two instances on the stage doing different things. How would I do that?
also, I've tried doing something like this:
var loader2:Loader = new Loader();
loader2 = loader; //also give an error, because the loader get's something from a URL
Hopefully that's enough info to go on. THANKS!
View Replies !
View Related
Problem With Loader Object, Some Users Donīt See The Content
Iīm having a weird problem where a Flash is loading another swf object through the a Loader object. For a certain group of users (in a different location), this swf does not load, and no error message or anything is returned.
For me and others in my office, this works without a hitch. Iīve tried adding various event listeners to the Loader, but it appears that for these people no events are fired. The other content in the main swf works just fine. This does not appear to be caused by firewall/adblockers/popup blockers, etc.
Iīm fairly new to Flash development, and I really have no idea where to start debugging this. Anyone ever experienced something like this? The swf that is supposed to be loaded is a loader itself, which again loads another, final swf. Everything is served through a webpage, so itīs really weird to see this inconsistent behaviour.
If anyone can give me some tips on where to start, it would be greatly appreciated.
View Replies !
View Related
Preloader For Loader Object And Caching Questions
Guys.
I have a simple flash widget that i built that works like a small image gallery. It has a couple of tabs so that if you click on tab 1 you go to frame 1 and so on and so forth.
The tricky part is that I'm using a Loader to load the image for each frame.
Its very fast on my computer but when its hosted, I imagine there will be a delay as the image gets loaded. Because of that I want to add a simple preloader to the image (% loaded in top left corner).
I'm not sure how to go about this ...
I also wondered if I could get any technical link or insight into how flash caching works. I develop in PHP, .NET etc so don't be afraid to bust out the complicated version of things.
Thanks
View Replies !
View Related
Controlling 2 Sets Of Bgnd Images Using The Loader Object
Hi,
I am trying to set up having a large background image loaded in on every main menu change on a website (what the client wants)
I am trying to use 2 versions of the loader component (i have version 8 pro) so I can 'cross fade' the images when they change by changing their depths etc. The problem is it works 90% of the time, here is the code:
Code:
var active_background:String = "my_ldr_A";
var inactive_background:String = "my_ldr_B";
var background_path:String = "images/background01.jpg";
//
this.createClassObject(Loader, "my_ldr_A", 2);
my_ldr_A.setSize(955, 600);
this.createClassObject(Loader, "my_ldr_B", 1);
my_ldr_B.setSize(955, 600);
//
function onEnd() {
trace("at end");
_root[active_background].addEventListener("progress", loadListener);
_root[active_background].addEventListener("complete", loadListener);
_root[active_background].contentPath = background_path;
}
//
var loadListener:Object = new Object();
loadListener.progress = function(eventObj:Object) {
trace("The image is "+_root[active_background].percentLoaded+"% loaded into "+active_background);
//here will go loader bar code
};
loadListener.complete = function(eventObj:Object) {
trace("active_background "+active_background+".depth = "+_root[active_background].getDepth());
trace("inactive_background "+inactive_background+".depth = "+_root[inactive_background].getDepth());
my_ldr_B.swapDepths(my_ldr_A);
//
_root[active_background].removeEventListener("progress", loadListener);
_root[active_background].removeEventListener("complete", loadListener);
//
var tempString:String = inactive_background;
inactive_background = active_background;
active_background = tempString;
};
the onEnd() function is called on the end of a tween, and even when it doesnt work the trace - trace("at end"); still traces out.
I am fairly new to objects n listeners etc so I would really appreciate some help here.
View Replies !
View Related
Name Property Of Loader Object Lost In CLICK Event.
PHP Code:
private function loadIcons():void{
count = 0;
iconArray = new Array();
for(var i:uint = 0; i < menuArray.length; i++){
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.INIT, placeIcons);
loader.load(new URLRequest("assets/icons/" + menuArray[i] + "_icon.swf"));
}
}
private function placeIcons(event:Event):void{
iconArray[count] = (loader.content as MovieClip);
var loadedContent:MovieClip = (loader.content as MovieClip);
//loadedContent.play(); needed for later to play ani.
iconArray[count] = loadedContent;
iconArray[count].addEventListener(MouseEvent.MOUSE_DOWN, menuSelected);
addChild(iconArray[count]);
count++;
}
private function menuSelected(event:Event):void{
//addChild(loader);
trace(event.target.name); //PROBLEM GETTING THE INSTANCE NAME OF THE BUTTON PRESSED!!!! Look into
}
Well, hard title.. sorry.
the object is to load a couple of swf's which serves as icons in a menu. I place these in an array so I can reference them later, then when clicked I need to know the id, name or anything about that swf to load the appropriate page which goes with the icon swf.
The problem is that even after I make the coercion to MovieClip on the "loadedContent" I am not allowed to set the "loadedContent.name = "instance name"" and no matter what I try all I get in the menuSelected function is "instance27" or what ever the player calls it at runtime..
I am quite sure I did this a thousand times, but now it does not work?
Thanks for any help given
View Replies !
View Related
Flash Bug With Loader Object When User's PC Has Mcafee Installed
Flash 8, windows XP SP2, latest flash player, IE 7
Doesn't matter the PNG image's actual size, the loaded image size will always be width 77, height 107. This bug will not show in firefox, only in IE.
After investigation, the cause of it is because the user PC has mcafee installed. When it is uninstalled or completly disabled( not in itselves control panel). The problem will be solved. Not sure if other anti-virus softwares will cause the same problem
Attach Code
tShirt[upload.side].tShirtImageLoader.scaleContent=false;
subPanes_1[upload.side].DesignUploaded.selected=true;
tShirt[upload.side].tShirtImageLoader.autoLoad=false;
tShirt[upload.side].tShirtImageLoader.contentPath = "http://" + domain + webRoot + "/_images_tshirts/tshirts_temp/" + upload.side + "/lo/" + tShirt[upload.side].imageNameLo;
tShirt[upload.side].tShirtImageLoaderListener = new Object();
tShirt[upload.side].tShirtImageLoader.addEventListener("complete", tShirt[upload.side].tShirtImageLoaderListener);
tShirt[upload.side].tShirtImageLoader.load();
tShirt[upload.side].tShirtImageLoaderListener.complete = function(eo) {
View Replies !
View Related
Anyone Have Problems With The Loader Component .complete Event Object?
I've found a bug with the .complete event object. The total variable with this object does not react property if there is a delay in downloading the requested image in IE.
Has anyone else ran into this problem??
The below code will seem to work fine, until you put a bandwidth limiter on port 80, or attempt to proxy the image through a script, then the following will occur:
1. The flash movie sends a get request for the image:
GET some.jpg HTTP/1.1
Accept: */*
x-flash-version: 8,0,22,0
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; InfoPath.1)
Host: 10.30.1.161
Connection: Keep-Alive
2. The Loader .complete function will fire and the 'total' variable in the event object will be -1 (failure).
3. The server will then respond with:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: image/jpeg
Content-Length: 110559
Date: Mon, 16 Oct 2006 19:09:13 GMT
Flash doesn't even attempt to wait for a response from the server.
This is horrible because there is no other way i can determine if there was an error while the image downloaded.
The time out, waiting for the response is very very low. We have only been able to reproduce this in IE with a bandwidth limiter. Firefox doesn't seem to repoduce the error.
Attach Code
import mx.controls.Alert;
import mx.utils.Delegate;
//Create loader instance.
this.createClassObject(mx.controls.Loader, "my_ldr", 10);
var poLoaderListener = new Object();
poLoaderListener.oScope = this;
poLoaderListener.complete = Delegate.create(this, function (oEvent)
{
mx.controls.Alert.show(oEvent.total);
});
poLoaderListener.progress = function() {};
my_ldr.addEventListener('complete', poLoaderListener);
my_ldr.addEventListener('progress', poLoaderListener);
my_ldr.load("http://www.bbcanada.com/pics/6676n.jpg");
View Replies !
View Related
TypeError: #1009 Null Object Reference And A Loader
Hi,
I'm having some trouble with the stage in AS3 when loading a swf into another swf.
I have a loader swf loading a swf with a document class which imports a few other classes. A sample from one of those imported classes follows:
Code:
// constructor
function ModelInfo() {
if (!allowInstantiation) {
throw new Error("Error: Instantiation failed: Use ModelInfo.getInstance() instead of new.");
} else {
createMouseOverHeading();
createMouseOverSubHeading();
createMouseOverDetails();
}
}
public static function getInstance(input:Stage):ModelInfo {
if (instance == null) {
myStage = input;
allowInstantiation = true;
instance = new ModelInfo();
allowInstantiation = false;
}
return instance;
}
As soon as the progress handler traces that the loader has loaded the entire swf (but before the init handler gets executed) I receive 1009 null object reference errors everywhere the stage is accessed.
Now.. unfortunately, general confusion does not make for a very good question...so,
Should the "addchild" for the loaded swf be on on the loader's onComplete handler, or somewhere else?
I've read about "ADDED_TO_STAGE" in several places, but how can I incorporate this into the above code?
Should the swf that is loaded compile properly on it's own to work with the loader?
Can anyone refer a good article that explains the problem I'm having? I've already tried several and I'm not confident that I understand it.
Thanks in advance
View Replies !
View Related
Load Multiple Images With Single Loader Object?
Hi, I'm trying to make a pretty simple rotating banner which loads images from an xml file and then transitions through them. I decided to load all of the images into an array to begin with rather than load them as they need to be displayed so there would be as little 'lag' as possible once the rotation begins.
Once the first image has been loaded in I want it to be added to the stage while the rest of the images continue to be loaded into the array in the background as it were, but this is where it all goes wrong.
The image loader is called from a function loadImages(), with an imgCount variable keeping track of how many images have been loaded so far, the load.complete event handler loadedimages then stores the image into an array using the imgCount variable as an index, the imgCount variable is incremented and a check is performed against the xml list to see if all of the images have been loaded, if not the loadImages() function is called again to load the next one. The problem specifically is that when I try to add the first image from the image array to the stage I receive the following error message:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::Loader/_load()
at flash.display::Loader/load()
at bannerRotator_fla::MainTimeline/loadImages()[bannerRotator_fla.MainTimeline::frame1:47]
at bannerRotator_fla::MainTimeline/loadedImages()[bannerRotator_fla.MainTimeline::frame1:53]
My code is as follows:
Code:
var xmlPath = "imagesXML.xml";
var imageList:XML = new XML();
var xmlLoader:URLLoader = new URLLoader();
var imageLoader:Loader = new Loader();
var timer:Timer;
var transitionType:String;
var transitionLength:String;
var imgContainers:Array = new Array();
var imgCount:Number = new Number(0);
//Load the image list xml file
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
xmlLoader.addEventListener(IOErrorEvent.IO_ERROR, xmlError);
xmlLoader.load(new URLRequest(xmlPath));
function xmlError(event:IOErrorEvent):void{
trace("specified file could not be loaded - check file name");
}
//once the xml has been loaded - set up the the variables and start the banner
function xmlLoaded(event:Event):void{
try{
imageList = XML(xmlLoader.data);
timer = new Timer(imageList.elements("delay")*1000);
transitionType = imageList.elements("transitionType");
transitionLength = imageList.elements("transitionLength");
}catch(e:Error){
trace("The xml file was found but it is not valid, make sure all tags are completed correctly and values are correct.");
}
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadedImages);
loadImages();
}
function loadImages():void{
imageLoader.load(new URLRequest(imageList.image[imgCount].@src));
}
function loadedImages(evt:Event):void{
imgContainers[imgCount]=imageLoader.content;
addChild(imgContainers[0]);
imgCount++;
if(imgCount<imageList.image.length())loadImages();
}
What really gets me is that if I include the addChild statement in an else conditionwith the final if() it works fine, how come I can't add the first image to the stage while the other images are loading? Any help would be massively appreciated, this is my first AS3 (mini) project, I thought it would take about 2 hours but so far it's 2 days and counting!! If anyone can help - many thanks in advance!
View Replies !
View Related
How Do You Select Or Target Dynamically Created Loader Object Instances
I am working on a bit of code the draws its images from a url generated from XML . I would like to then use the images to be click-able so I can further work with them. the last 3 lines aint doing the trick.
Here is what I got so far.
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest("http://www.squisheesoft.com/xml/books.xml"));
function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
ParseBooks(xmlData);
}
function ParseBooks(bookInput:XML):void {
disp1(xmlData);
}
function disp1(bookInput:XML):void {
var exp:int = 0;
for (var i:int = 0; i < bookInput.Book.length(); i++) {
var loader:Loader = new Loader();
loader.name = "loader_"+i;
this.addChild(loader);
loader.load(new URLRequest(bookInput.Book.image.text()[i]));
loader.x = exp;
exp += 100;
trace(bookInput.Book.length());
trace(loader.name);
}
}
this.loader_1.addEventListener(MouseEvent.MOUSE_DO WN, startDr);
function startDr():void {
this.loader_1.startDrag();
trace("hi");
}
Genius with a handicap( WHEE*THUD*WHEE*THUD*WHEE*THUD*)
View Replies !
View Related
Loader Class Not Visually Showing Loaded Object On Stage
I have this code in a class:
Code:
package com.jhoyt{
import flash.net.URLRequest;
import flash.events.*;
import flash.display.*;
public class SSIlaunch extends MovieClip {
var Loada:Loader=new Loader;
public function SSIlaunch() {
var ssiFile:URLRequest=new URLRequest("SSI.swf");
Loada.contentLoaderInfo.addEventListener(Event.COMPLETE,addAndPoint);
Loada.load(ssiFile);
}
function addAndPoint(ev:Event):void {
addChild(ev.currentTarget.content);
}
}
}
and I have this code on the timeline of the movie its being loaded into:
Code:
import com.jhoyt.SSIlaunch;
var ssi:SSIlaunch = new SSIlaunch();
addChild(ssi);
I know its loading because I can put trace actions into the addAndPoint function and it gets called. what can I do to make it display?
View Replies !
View Related
Loader Class Not Visually Showing Loaded Object On Stage
I have this code in a class:
Code:
package com.jhoyt{
import flash.net.URLRequest;
import flash.events.*;
import flash.display.*;
public class SSIlaunch extends MovieClip {
var Loada:Loader=new Loader;
public function SSIlaunch() {
var ssiFile:URLRequest=new URLRequest("SSI.swf");
Loada.contentLoaderInfo.addEventListener(Event.COMPLETE,addAndPoint);
Loada.load(ssiFile);
}
function addAndPoint(ev:Event):void {
addChild(ev.currentTarget.content);
}
}
}
and I have this code on the timeline of the movie its being loaded into:
Code:
import com.jhoyt.SSIlaunch;
var ssi:SSIlaunch = new SSIlaunch();
addChild(ssi);
I know its loading because I can put trace actions into the addAndPoint function and it gets called. what can I do to make it display?
View Replies !
View Related
Is My Pre-loader Loading?
Hi, i've done a site and it has two scenes, the main scene and a preloader.
The pre-loader was from a tutorial and calculates bytes loaded bytes remaining percentage loaded ect.
When i publish the site and view the size report it looks similar to the following, does this mean that my movie isn't actually preloading?
Frame | Frame bytes
1 | 5
2 | 4568 i assume this is because of the
3 | (constant..) preloader but why do i get an
increse again later in the movie
33 | 8598
34 | (constant..)
This shorely means my preloader is not working properly??
Is it because i used scenes? is there any way of copy the contents of one scene(several layers) to the start of another scene efficiently?
Thanks for any help
View Replies !
View Related
Pre-loader NOT LOADING
I have a movie called resume.fla and in that movie have a pre-loader on the firs frame with the following action script;
stop();
onClipEvent (enterFrame) {
loading = _parent.getBytesLoaded();
total = _parent.getBytesTotal();
percent -= (percent-((loading/total)*100))*.25;
per = int(percent);
percentage = per+"%";
loadBar._width = per;
if (percent>99) {
_parent.gotoAndStop(2);
}
}
The animation and movie proceeds then on to frame 2. However, the pre-loader doesnot work. I used it in many other movies I am building and it works fine. Do I have the wrong decription tag; (i.e.- _parent instead of maybee a _parent._parent or _this tag)? Any help would be great. Thanks and if you need to see the fla to see hwat I am talking about, let me know where I can email it to you. Thanks a million.
View Replies !
View Related
Help Loading XML Into Loader
i have a Loader object which loads a swf into a sprite.
within this class that extends Sprite i have a method to load data from an XML file. i want this string to be loaded into a certain dynamic text field inside the .swf movieclip loaded by Loader.
how do i do this?
this is what i want to do:
Code:
private var _loader:Loader = new Loader();
private function init():void{
_loader.load(new URLRequest(cfg.modelDir + _modelName + cfg.modelExt));
this.addChild(_loader);
//load xmls
initXML("external_file_name.xml");
}
private function initXML(xml_str:String):void{
var request:URLRequest = new URLRequest(cfg.xmlDir + xml_str + cfg.xmlExt);
xml_loader.load(request);
xml_loader.addEventListener(Event.COMPLETE, loadXML);
}
private function loadXML(event:Event):void{
var xml_loader:URLLoader = event.target as URLLoader;
var externalXML:XML;
if (xml_loader != null)
{
externalXML = new XML(loader.data);
_loader.content.dynamic_txt = externalXML.content[0];
}else{
trace("XMLloader is not a URLLoader!");
}
}
this is pretty much out of the AS3 help in flash.
_loader is the Loader object.
_loader.content is supposed to be the loaded swf movieclip (according to AS3 docs)
_loader.content.dynamic_txt is supposed to be a dynamic text field in the .swf file on root movieclip.
the error i get is:
Code:
1119: Access of possibly undefined property dynamic_txt through a reference with static type flash.display:DisplayObject.
i have a feeling i need to set up some event handler for when the Loader.content is done loading (using a Loader.contentLoaderInfo event and listener), but i don't know how to do this. how can i make both events run? how do i nest all the xml stuff into an LoaderInfo.INIT event handler?
View Replies !
View Related
Loading AS2 Swf Into AS3 Loader.
Hi all,
I'm having a slight problem when loading an AS2 file into my AS3 loader and then putting it into a movieclip.
It loads in fine but then when I go to load in a AS3 swf afterwards I get this error:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display:isplayObjectContainer/removeChild()
at lgw_fla::MainTimeline/currentPageGone()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunctio n()
at flash.events::EventDispatcher/dispatchEvent()
at fl.transitions::Tween/set time()
at fl.transitions::Tween/nextFrame()
at fl.transitions::Tween/fl.transitions:Tween:nEnterFrame()
Any thoughts?!
<code>function showNextPage():void {
//Tween the next page from left to the center
//nextPage.x = 10;
var tweenY:Tween = new Tween(nextPage, "y", Regular.easeOut,
600, 100, 1, true);
//Tween the alpha to from 0 to 1
var tweenAlpha:Tween = new Tween(nextPage, "alpha", Regular.easeOut,
0, 1, 1, true);
//Push the tweens into an array
tweens.push(tweenY);
tweens.push(tweenAlpha);
/*//Add the next page to the stage
addChild(nextPage);*/
target_mc.addChild(nextPage);
//Next page is now our current page
currentPage = nextPage;
}
//This function is called when the current page has been animated away
function currentPageGone(e:Event):void {
//Remove the current page completely
target_mc.removeChild(currentPage);
//Let's show the next page
showNextPage();
}</code>
View Replies !
View Related
Loader Not Loading
Hi all,
I'm sure this a real noob question but I can't seem to get this to work. I'm just trying to load an image I know that the variable img_path is being set correctly because of the trace statements, and LittleSnitch tells me that it is connecting to google. but the image will not display.
my class
Code:
package com.fieldsofcorn.loaders {
import flash.display.MovieClip;
import flash.display.Loader;
import flash.net.URLRequest;
public class LoadImage extends MovieClip {
private var img_path:String;
public function LoadImage(path) {
trace(path)
this.img_path = path;
init();
} // end constructor
public function init():void {
var loader:Loader = new Loader();
addChild(loader);
trace(this.img_path);
loader.load(new URLRequest(this.img_path));
} // end init
}// end class
} // end package
and this is in the first frame of my movie:
Code:
import com.fieldsofcorn.loaders.LoadImage
var img:LoadImage = new LoadImage("http://www.google.com/intl/en_ALL/images/logo.gif");
Any help would be great. My first AS3 project.
View Replies !
View Related
Pre-loader For Loading External .swf
How do I use a pre-loader when trying to load an external (flix .swf) movie into a emtpy movie clip? I can not edit the external swf. The movie loads and plays no problem. I can control the time line with the tellTarget method. I just want the loading...loading...to continue until the majority of the clip has loaded, just like using a pre-loader on the maintime line. THX
[Edited by newFlashRookie on 05-26-2002 at 11:33 AM]
View Replies !
View Related
Loading External Swf Loader Bar
I want to load an external swf into my movie, but i want to have a progress bar on it, so i can say something fancy like "loading roster data" and have a progress bar, or percentage. I used the getbytes total stuff for my main preloader, and it works GREAT, but can i use it again in this instance(no pun intended)? Thanks
[Edited by denmark219 on 09-24-2002 at 12:01 AM]
View Replies !
View Related
Loading External Mp3's Using Loader
Hello I have used this script to load external mp3's into flash. It works ok locally (and using flash download simulator) but when on line it doesnt seem to be able to read the bytes total or get bytes loaded and just doesnt do anything? any suggestions? p.s im playing is after 1/5 is loaded.
onClipEvent (enterFrame) {
if (firsttrack == 0) {
vol = 100;
_parent.tckname.text = "buffering";
_parent.tckfrom.text = "";
my_sound = new Sound();
my_sound.loadSound("tracks/track"+1+".mp3", true);
total = Math.round(my_sound.getBytesTotal());
my_sound.stop();
my_sound.setVolume(vol);
_parent.slider.bar._xscale = vol;
startLoader = 1;
my_sound.onSoundComplete = autoplay;
firsttrack = 1;
}
if (startLoader == 1) {
loaded = Math.round(my_sound.getBytesLoaded());
percent = Math.round((loaded/total*100)*5);
_parent.tckfrom.text = percent+"%";
if (percent>=100) {
my_sound.start(0, 10000);
my_sound.setVolume(100);
_parent.tckname.text = my_sound.getBytesTotal();
_parent.tckfrom.text = my_sound.getBytesLoaded();
playnum = 0;
startLoader = 0;
}
}
}
thanks,
Craig
View Replies !
View Related
Loading External Mp3's Using Loader
Hello not sure if anyone can help but am having trouble loading external mp3's... works when i do test export from flash simulating download but doesn't work on server... has anyone had a problem like this before? Heres the code I'm using... p.s. im not loading 100% in startloader but thats ok just wanted to load 1/5 before playing...
onClipEvent (enterFrame) {
if(firsttrack == 0){
vol = 100;
_parent.tckname.text = "buffering";
_parent.tckfrom.text = "";
my_sound = new Sound();
my_sound.loadSound("tracks/track1.mp3", true);
total = Math.round(my_sound.getBytesTotal());
my_sound.stop();
my_sound.setVolume(vol);
startLoader = 1;
my_sound.onSoundComplete = autoplay;
firsttrack = 1;
}
if(startLoader == 1){
loaded = Math.round(my_sound.getBytesLoaded());
percent = Math.round((loaded/total*100)*5);
_parent.tckfrom.text = percent + "%";
if(percent>=100){
my_sound.start(0, 10000);
my_sound.setVolume(vol);
_parent.tckname.text = my_sound.getBytesTotal();
_parent.tckfrom.text = my_sound.getBytesLoaded();
startLoader = 0;
}
}
}
View Replies !
View Related
[F8] Loading Different Movies Into One Loader
Here's what the problem: I have a series of a dozen buttons, each loading a different movie clip. The script I'm using on the button is:
on (press) {
this._parent.gotoAndPlay ("demo")
}
//demo is a frame name, each movie clip has it's own frame name
Then at the frame it sends you to, I have the script:
stop();
{
_root.createEmptyMovieClip("swfHolder", this.getNextHighestDepth());
_root.swfHolder.loadMovie("demo.swf");
_root.swfHolder._x=815;
_root.swfHolder._y=245;
_root.swfHolder._xscale=100;
_root.swfHolder._yscale=100;
}
On each button, I have a script that will go to and play a particular frame, one area on the timeline about 30 frames long for each button. I want to eliminate the need for multiple areas on the timeline for each button, if that makes sense. Basically, whether you click button 1 or 2 or whatever, I want it to go to the same spot on the timeline, but load the corresponding movie for each button. Click button 1, go to frame "demo" and play movie 1. Click button 2, go to frame "demo" and play movie 2. Any ideas what that script would look like? hopefully it's just a small adjustment to what I have!
If this is possible, I would also need a script for a button made to close this movie clip. The one I'm using currently is:
{
_root.swfHolder.unloadMovie("demo.swf");
}
Would I just have to duplicate that script for each movie and Flash will cycle through it, unloading any that are listed that are currently open?
Any help or insight would be greatly appreciated, as what I am working on is due Friday!
View Replies !
View Related
Pre-loader Not Loading In Browser
Hi,
I am having trouble getting my pre-loader to work on my actionscript controlled image gallery. When it loads in the browser, the pre-loader does not appear until the movie is fully loaded (and the user only sees a blank screen), then you see a quick glimpse of it and it goes straight into the movie, see link http://www.testgallery.eliteweddingsandevents.com.au/
I have a pre-loader layer, actions layer and the gallery layer.
On the Actions layer I have this code:
Code:
myProgressBarListener = new Object();
myProgressBarListener = function (eventObject) {
myProgressBar._visible = false;
gotoAndPlay("gallery");
};
myProgressBar.addEventListener("complete", myProgressBarListener);
myProgressBar.mode = "polled";
myProgressBar.source = "_root";
myProgressBar.label = "LOADING %3%%";
myProgressBar.direction = "right";
myProgressBar.labelPlacement = "bottom";
stop();
The code that controls the Image Gallery is as follows:
Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
this.createEmptyMovieClip("container",1);
var imagesNumber:Number = 5;
var scrolling:Boolean = true;
for (i=1; i<=imagesNumber; i++) {
container.attachMovie("thumb"+i,"thumb"+i+"_mc",i);
myThumb_mc = container["thumb"+i+"_mc"];
myThumb_mc._x = (i-1)*myThumb_mc._width;
myThumb_mc._y = (Stage.height-myThumb_mc._height)/2;
myThumb_mc._alpha = 50;
myThumb_mc.largerImage = i;
myThumb_mc.onRollOver = function() {
this._alpha = 100;
};
myThumb_mc.onRollOut = function() {
this._alpha = 50;
};
myThumb_mc.onRelease = function() {
this._alpha=50;
for (i=1; i<=imagesNumber; i++) {
var myClip = container["thumb"+i+"_mc"];
myClip.enabled = false;
}
scrolling = false;
_root.attachMovie("image"+this.largerImage,"large_mc",2);
large_mc._x = (Stage.width-large_mc._width)/2;
large_mc._y = (Stage.height-large_mc._height)/3;
new Tween(large_mc, "_alpha", Strong.easeOut, 0, 100, 0.5, true);
new Tween(container,"_alpha",Strong.easeOut,100,50,0.5,true);
large_mc.onRelease = function() {
scrolling = true;
var myFadeOut = new Tween(large_mc, "_alpha", Strong.easeOut, 100, 0, 0.5, true);
new Tween(container,"_alpha",Strong.easeOut,50,100,0.5,true);
myFadeOut.onMotionFinished = function() {
for (i=1; i<=imagesNumber; i++) {
var myClip = container["thumb"+i+"_mc"];
myClip.enabled = true;
}
large_mc.removeMovieClip();
};
};
};
}
container.onEnterFrame = function() {
if (scrolling){
this._x += Math.cos((-_root._xmouse/Stage.width)*Math.PI)*15;
if (this._x>0) {
this._x = 0;
}
if (-this._x>(this._width-Stage.width)) {
this._x = -(this._width-Stage.width);
}
}
};
View Replies !
View Related
Loader - How To Unload Before Loading Again
I am trying to set up a portfolio page in AS3, which when I click samp1_btn it loads the first object into my imageLoader, 'file1.png', then with a click of samp2_btn, 'file1.png' unloads and 'file2.png' loads in its place.
Now, there is going to a number of sample files, including .png's and .swf's (which some have flash players). All of the files are transparent and when loaded on one another can be seen over top of each.
Basically my question is how to set it up so that there is some way to tell when the button is clicked if there has already been an object loaded into the imageLoader. Also, how would I tell samp1_btn when its clicked that if it's content is already loaded, not to load it again.
I would imagine I'd have to use some type of imageLoader.currentLoaderInfo.addEventListener?
CURRENT CODE:
samp1_btn.addEventListener(MouseEvent.CLICK, loadsample1);
function loadsample1(event:MouseEvent):void
{
var imageRequest:URLRequest = new URLRequest("file1.png");
var imageLoader:Loader = new Loader();
imageLoader.load(imageRequest);
addChild(imageLoader);
}
samp2_btn.addEventListener(MouseEvent.CLICK, loadsample2);
function loadsample2(event:MouseEvent):void
{
var imageRequest:URLRequest = new URLRequest("file2.png");
var imageLoader:Loader = new Loader();
imageLoader.load(imageRequest);
addChild(imageLoader);
}
Thanks for any help.
~ will
View Replies !
View Related
Loading Jpg With Loader Component
I'm calling jpg files from Action Script, loading it on a Loader component.
Mi problem is on the first loading off each jpg file (using internet explorer).
The jpg doesn't resize to the size of the component.
The component has scaleContent=true.
The problem is only whith the firs call to each file.
Is it a bug of flash player?
Thank you
View Replies !
View Related
Loading A Movie Into The Same Loader
Hi
I load swf files into a loader from my main menu on the stage. these subfiles then have buttons which need to load further swf files into the same loader they are being launced from. I thought this was possible using _root but i cant get it to work! Any body offer any advice???
Yours Hopefully
Neil
View Replies !
View Related
Loading Random Loader
Guys,
I've just done the random loader tutorial, which previews in Flash fine, but when I insert it into Fetch to load it on the net, the .swfs don't load onto the page.
All of the swfs are in the same directory, so I think I'm either being the largest prat on the planet, or doing something horribly wrong.
I've checked the past threads and can't see any other problems like mine posted, so I must surely be doing something basic wrong.
All answers will be read and digested, I promise.
Charlie
View Replies !
View Related
|