Loader OnComplete Firing, But TextField Not Disappearing
I have event listeners for when an image is loading and for when loading is complete.Both of them fire--I've used traces to confirm that.But I can't get the text field that says "Loading..." to disappear once the image has loaded. I've tried making the text field invisible, making the text equal nothing, and removing it as a child. Nothing is working. Maybe I am not manipulating the text field properly? Attach Codevar LoadingTFld:TextField;var imageLoader:Loader = new Loader();var image:URLRequest = new URLRequest(neighXML.neighborhood.image_path[i]);imageLoader.load(image);imageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onImgLoadProgress, false, 0, true);imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onImgLoadComplete, false, 0, true);imageLoader.x = pEvent.stageX+20;msgX = imageLoader.x;imageLoader.y = pEvent.stageY+48;msgY = imageLoader.y;//add image to spritemySprite.addChild(imageLoader);function onImgLoadProgress(evt:ProgressEvent):void {loadingTFld = new TextField();loadingTFld.width = 250;loadingTFld.text = "Loading...";loadingTFld.setTextFormat(loadingTFmt);mySprite.addChild(loadingTFld);loadingTFld.x = loadingTFld.y = 400;}//end functionfunction onImgLoadComplete(evt:Event):void {mySprite.removeChild(loadingTFld);loadingTFld.text = "";loadingTFld.visible = false;}//end function
Adobe > ActionScript 3
Posted on: 12/04/2008 08:26:46 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Loader OnComplete Not Firing
This is my script, very simple. But the event listener is not firing. I'm obviously missing something but I can't see what. Can one of you flash mavens please help me here? Thanks in advance.
var ldr:Loader = new Loader();
ldr.addEventListener(Event.COMPLETE, load_complete);
var urlReq:URLRequest = new URLRequest("images/image0.jpg");
ldr.load(urlReq);
function load_complete(e:Event) {
trace("load complete");
}
[mx 2004] Loader Component Oncomplete Event
I am having problem with oncomplete event of loader.
This event fires before the content of the loader is actually loaded.
I tried to load a image through the loader, small images are loaded fine.
But for large images, the loader complete event is fired before actually the image is displayed.
I tried placing a delay after the oncomplete event, so that image gets rendered for displaying, but this delay would vary of large images.
Any help will be appreciated
Loader Event Not Firing - Actionscript 3
Hi,
I have found that Event.COMPLETE doesn't get dispatched in IE 6 or 7 on a PC, but does in Firefox and the Flash authoring environment.
I would like the swf to declare when it has completed loading. The code is below. SImply put it into frame 1 of the main timeline and publish it.
In Flash and Firefox it will say 'Initiated' and 'Completed'. In IE it will just say 'Initiated'.
Could somebody give it a try - it's very confusing.
Thanks.
var debugText:TextField = new TextField()
addChild(debugText)
var onEvent = function (event:Event):void
{
trace(event.type)
debugText.text += event.type + "
"
}
loaderInfo.addEventListener(Event.INIT, onEvent);
loaderInfo.addEventListener(Event.COMPLETE, onEvent);
Loader Class Not Firing Event.COMPLETE
I'm having a problem that's got me stuck in AS3. I have this seemingly simple code:
PHP Code:
var loader:Loader = new Loader();
loader.addEventListener(Event.COMPLETE, function(event:Event):void{
trace('hi');
});
loader.load(new URLRequest('photo.jpg'));
The event.complete is never firing. Nothing I do works. If I make it a URLLoader and not a regular Loader it goes through fine and the event is fired, however this is an image I need to add to the stage so I need to use a Loader. But I can't figure out for the life of me why the event.complete isn't firing. I know it's loading because I can add the loader to the stage and the image shows up. Doesn't matter if I do local images or images from a server. What's going on here?
Loader Class Not Firing COMPLETE Event
Hello hello,
So I've got a bit of a problem that is absolutely puzzling me.
I've got a custom Thumbnail class that reads in an image path, a label, and an index. The class simply loads the image and and onComplete it pulls the bitmap out of loader.content, assigns it to a public variable and then dispatches an event saying its completed.
I use these thumbnails in a thumbnail gallery and I don't build the gallery in until all thumbnails are loaded and ready. The problem is the COMPLETE event doesn't always fire for every thumbnail, therefore not allowing the gallery to build.
I used a ProgressEvent.PROGRESS to make sure the files were being loaded, and found that when the loads failed the loader still loaded the totalBytes.
I've also tried Event.INIT and its the same issue.
INIT and COMPLETE just don't seem to be either caught or dispatched.
If anyone is familiar with a problem like this I'd appreciate any help that you could provide.
Thanks in advance.
Code:
public class Thumbnail extends Sprite
{
/******************************************************************************************
* VARIABLES
*****************************************************************************************/
public var label: String;
public var link: String;
public var imagePath: String;
public var index: int;
protected var image: Bitmap;
protected var loader: Loader;
/******************************************************************************************
* CONSTRUCTOR
*****************************************************************************************/
public function Thumbnail(p_imagePath: String, p_label: String = "", p_index: int = 0)
{
//init variables
imagePath = p_imagePath;
label = p_label;
index = p_index;
//setup the loader and the onComplete
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.INIT, onLoadComplete, false, 0, true);
loader.load(new URLRequest(imagePath));
}
/******************************************************************************************
* DECONSTRUCTOR
*****************************************************************************************/
public function destroy():void
{
loader = null;
}
/******************************************************************************************
* EVENT HANDLERS
*****************************************************************************************/
/**
* Handles the loader event when the image loading is done
**/
private function onLoadComplete(evt: Event):void
{
image = Bitmap(loader.content);
addChild(image);
dispatchEvent(new Event(Event.COMPLETE));
}
}
Why Is My Dynamic TextField Disappearing
Hi,
I have a symbol which is a movie clip with a dynamic textField inside it, I load a jpg image into an instance of this symbol (pic1) and place in on the stage, where it can be draged, and I want the textFiled to be draged with it. However the dynamic textFiled disappears when I add the jpg to the stage using the instanceOfPic1.loadMovie("myJPG") command.
Why does this happen? Or is there another way to drag a mc and a textBox at the same time ? I have attached a copy of my project
Thanks
Dave
Loader Component Contents Disappearing In A Slideshow?
I have a simple looping slideshow on one of our sites that I built using the loader component, and it loads in a different SWF file on each frame. It just skips ahead step by step with a little pause script and each frame of the main timeline has a loader component in it. It works fine, but one thing that bugs me is between each frame, the contents of the last one vanishes for a second while the new one loads.
Does anyone know if there's a way to keep the contents of the previous frame always visible until it's time to show the next one?
I tried "stacking" the frames on different layers but it seemed that the movie would just freeze up after it unloads the first movie if there was a loader trying to load on top of another. Any ideas?
I'm using Flash CS3 but I'd like to export the movie down a couple of versions. We usually try and shoot for Flash 7.
If you'd like to see what we have you can check out the site, http://www.gutsywomentravel.com
Input TextField : Disappearing Text
Check this out:
http://starcam.com/camraw
Use Safari or Firefox - IE is not an issue.
Try entering text in the username/password field a few times.
You will probably notice that on a pretty regular basis the text will disappear as you type.
Has anyone else seen this...and can anyone confirm what I am seeing?
Note: I have found that this problems shows up more often if you select the input textfield and type something - then select all text you just typed and delete using backspace. Once you delete the text...start typing again...you should see it.
Dynamic Textfield Disappearing 2nd Time Showing?
Hi guys, Iīm creating a dynamic password field. Works like a charm.
BUT!
If the user navigates away from the screen itīs on, and come back, the text field canīt take input anymore.
Flash says the field is there.
That itīs a input field.
The pointer changes alrigt, but i cant type into it? and the bug fixing text i put into it disappears.
When navigating to another page i kill the movieclip itīs in with:
ActionScript Code:
removeMovieClip(var_holding_clip);
Anyone ever had a similar problem?
/Micke
GotoAndPlay OnComplete
Hi guys!
sorry for the strange title but I really don't know how to call this thread.
Well, my problem is quite easy. I've always created animations by code but now for a work I've to create them without using code. The problem is that I don't know how to create something like "onComplete".
I have a movieclip and an animation for the Mouse_over and an animation for the Mouse_out but how can I tell to my script to do the second animation only when the first one is completed?
This is the animation on my frames :
and the code that is very simple :
Code:
pulsante_mc.addEventListener(MouseEvent.MOUSE_OVER, pulsanteOver);
pulsante_mc.addEventListener(MouseEvent.MOUSE_OUT, pulsanteOut);
function pulsanteOver(evt:MouseEvent):void
{
linguetta_mc.gotoAndPlay(1);
}
function pulsanteOut(evt:MouseEvent):void
{
linguetta_mc.gotoAndPlay(18);
}
I thought to use a boolean variable, or something like "currentframe" but I really don't know how. I've also searched in the forum but.. nothing. So, I hope that someone will help me
An OnComplete Event For A Mc?
Hi all,
I am loading a jpg pic into a holder movie clip. I was wondering if I can
create a listener that will listen for when the jpg is done loading.
This is what i tried in the movie clip actions
PHP Code:
onClipEvent(load)
{
picListener = new Object();
picListener.onComplete = function()
{
trace("completed");
}
this.addListener(picListener);
}
It doesn't work and im assuming its because the movie clip doesn't
have the onComplete event? How can I go about this, is there another event? Please keep in mind i cant use MovieClipLoader class because my
app must be compatible with player v6.
THANKS
MCM
Help With TweenMax OnComplete
I would like to go to a certain frame in my timeline after the last tween has finished!
what would the code look like
i kno it most likely will have a "onComplete"
somewhere in it most likely
HTML Code:
import gs.TweenMax;
//what elsee?? =[
Video OnComplete?
is there a way to have an external .flv tell the main timeline to do something AFTER the video is done playing??
I am using setInterval now, but there must be a better way!??
//load external video.....
// Create a NetConnection object:
var netConn:NetConnection = new NetConnection();
// Create a local streaming connection:
netConn.connect(null);
// Create a NetStream object and define an onStatus() function:
var netStream:NetStream = new NetStream(netConn);
netStream.onStatus = function(infoObject) {
status.text += "Status (NetStream)"+newline;
status.text += "Level: "+infoObject.level+newline;
status.text += "Code: "+infoObject.code+newline;
};
// Attach the NetStream video feed to the Video object:
videoPlayer.myVideo.attachVideo(netStream);
// Set the buffer time:
netStream.setBufferTime(5);
// Being playing the FLV file:
netStream.play("video/silversea.flv");
stop();
trace("pause video");
// this function stops the playhead for a set period of time
function stopHere() {
//exit video player...
stop();
trace("resume");
}
//stop for specified time
var intervalID;
intervalID = setInterval(stopHere, 65000);
OnComplete Error In AS3.0
I posted this before but I think I posted in the wrong place so my apologies for posting twice.
I"m very new to ActionScript. I'm trying to work with Tweener and have been following your tutorials. When I try to combine two codes in one file I'm running into this Tweener error. It plays ok until I hit one of the buttons then I get this error in the output window:
## [Tweener] Error: : [object air] raised an error while executing the'onComplete'handler.
If I remove the onComplete event everything works well but then the intro animation only plays one.
stop();
import caurina.transitions.*;
//Navigation Code
home_btn.addEventListener(MouseEvent.CLICK, homePage);
interactive_btn.addEventListener(MouseEvent.CLICK, interactivePage);
print_btn.addEventListener(MouseEvent.CLICK, printPage);
about_btn.addEventListener(MouseEvent.CLICK, aboutPage);
function homePage(e:MouseEvent):void
{
gotoAndStop("home");
}
function interactivePage(e:MouseEvent):void
{
gotoAndStop("interactive");
}
function printPage(e:MouseEvent):void
{
gotoAndStop("print");
}
function aboutPage(e:MouseEvent):void
{
gotoAndStop("about");
}
//Movie intro code I will like it to loop over and over until you hit one of the buttons
import caurina.transitions.*;
function bars1 ()
{
Tweener.addTween (this.intro_mc.bars, {height:400, alpha:0, x:0,
time:3, onComplete:bars1,
transition:"easeInOutBack"});
}
function alpha1 ()
{
Tweener.addTween (this.intro_mc.frame, { delay:1, alpha:0,
time:2, onComplete:alpha1,
transition:"easeInOutBack"});
}
function mover1 ()
{
Tweener.addTween (this.intro_mc.intro.air, {delay:2, x:1114,
time:2, rotation:Math.random()*200, onComplete:mover1,
transition:"easeInOutBack"});
}
function mover2 ()
{
Tweener.addTween (this.intro_mc.intro.air2, {delay:4, x:Math.random()*stage.stageWidth,
time:2, rotation:Math.random()*300, onComplete:mover2,
transition:"easeInOutElastic"});
}
function mover3 ()
{
Tweener.addTween (this.intro_mc.intro.air3, {delay:4, x:Math.random()*stage.stageWidth,
time:2,rotation:Math.random()*300, onComplete:mover3,
transition:"easeInOutBack"});
}
function mover5 ()
{
Tweener.addTween (this.intro_mc.intro.air5, {delay:2, x:84.5,
time:2, rotation:Math.random()*200, onComplete:mover5,
transition:"easeInOutBack"});
}
function mover6 ()
{
Tweener.addTween (this.intro_mc.intro.bar, {delay:5, x:Math.random()*stage.stageWidth,
time:2, onComplete:mover6,
transition:"easeInOutBack"});
}
function mover7 ()
{
Tweener.addTween (this.intro_mc.intro.bar2, {delay:6, x:Math.random()*stage.stageWidth,
time:3, onComplete:mover7,
transition:"easeInOutBack"});
}
function mover8 ()
{
Tweener.addTween (this.intro_mc.intro.air3, {delay:6, width:Math.random()*stage.stageWidth,
time:3, onComplete:mover8,
transition:"easeInOutBounce"});
}
bars1();
alpha1();
mover1();
mover2();
mover3();
mover5();
mover6();
mover7();
mover8();
Dragslidefade Help... OnComplete: Question
I am learning how to use the dragslidefade objects and I see there is an instance property "onComplete:"
I dont know how to use this but I hope it can solve my current problem.
I have my movie clip with several photos on its timeline.
onRelease i use blur to blur my image and fade out.
After the animation is complete I would like to tell it to gotoAndPlay another frame in the same movieclip.
Can someone please advise me on how I can resolve this issue?
Does the onComplete function like that? and if so how can i get it to work?
Or is there another way of going about this?
Any help would be greatly appreciated!
Thanks!
[CS3] DragSlideFade - Timeline.as Add OnComplete?
Like the title says, I'm using Brendan Dawes dsf classes. Rewind.as has the onComplete property - but not the Timeline.as - can this be added to the .as file?
I need to trigger an action when the playhead reaches frame 1 - the rewind.as is too slow for the 100 frame movie I'm working with, but the Timeline.as works perfectly - if I can set up a listener for the onComplete.
Thanks in advance for anyone's input!
Timeline.as:
Code:
/**
Move playhead of the targeted MovieClip to a specified frame over time
@author Brendan Dawes
@version 1.0
@example
<code>
var f:Timeline = new Timeline(instanceName,1);
f.movePlayheadTo(100,5);
</code>
*/
class com.dragslidefade.Timeline {
private var target:MovieClip;
private var depth:Number;
/**
@param target the MovieClip you want to control
@param depth the depth of the MovieClip
*/
function Timeline($target:MovieClip,$depth:Number) {
target = $target;
depth = $depth;
}
/**
@param f the frame number you want to move to
@param s the speed of the tween - higher numbers are slower
*/
public function movePlayheadTo (f:Number,s:Number){
target.createEmptyMovieClip("dsf_timeline",depth);
target.dsf_timeline.targetF = f;
target.dsf_timeline.startSpeed = s;
target.dsf_timeline.precision = 2;
target.dsf_timeline.onEnterFrame = function(){
//trace(this._parent._currentframe);
if(Math.abs(this._parent._currentframe - this.targetF) < this.precision){
this._parent.gotoAndStop(this.targetF);
this.removeMovieClip();
}
this.newFrame = Math.round(this._parent._currentframe -= (this._parent._currentframe - this.targetF)*.1);
this._parent.gotoAndStop(this.newFrame);
}
}
}
Rewind.as:
Code:
/**
Rewind Class
@version 1.0
@author Brendan Dawes
*/
class com.dragslidefade.Rewind {
private var target:MovieClip;
private var depth:Number;
/**
Rewinds the timeline to a specified frame
@param $target the instance name of the MovieClip you want to rewind
@param $depth the depth of the script clip - usually 1 is fine
@example
<code>
var c:Rewind = new Rewind(mc_name);
c.rewindTimeline(1);
</code>
*/
public var onRewindComplete:Function;
public function Rewind($target:MovieClip,$depth:Number) {
target = $target;
depth = $depth;
}
/**
@param frameNumber the frame to rewind to
*/
public function rewindTimeline(frameNumber:Number) {
var pointer:Object = this;
if (frameNumber < target._currentframe) {
target.createEmptyMovieClip("dsf_Rewind",depth);
target.dsf_Rewind.onEnterFrame = function() {
this._parent.prevFrame();
if (this._parent._currentframe <= frameNumber) {
this._parent.stop();
pointer.onRewindComplete();
delete this.onEnterFrame;
this.removeMovieClip();
}
}
}
}
}
Tween Class, OnComplete()?
is there some sort of event that you can trigger once a tween finishes, when you're using the tween class?
here's my code
Code:
function tweenSizing(myMC, newSize)
{
easeType = mx.transitions.easing.Elastic.easeOut;
var begin = myMC._xscale;
var end = myMC._xscale + newSize;
var time = 2;
var mc = myMC;
ringTween = new mx.transitions.Tween(mc, "_xscale", easeType, begin, end, time, true);
ringTween2 = new mx.transitions.Tween(mc, "_yscale", easeType, begin, end, time, true);
}
tweenSizing(spaceman_mc, 300);
is there something like....
onComplete = function()
{
doSomething();
}
???
thanks!
OnComplete Of Layer Sound?
Hey guys,
I recently put a sound on a layer, so it plays when its on that layer. I want to know how to go to the next frame when the sound is complete..any way with actionscript to know when its done?
thanks!
OnComplete Event For MovieClips?
Is there an event like onComplete for a mc?
I have a holder mc that loads an external .jpg file into it (a company logo)
The database chooses the jpg file to load and it takes a couple of seconds.
Once the jpg is loaded into the holder_mc I want to be able to get the width, but onLoad event fires before the data has fully downloaded to flash, so I was wondering if there was another event I could use with a movieclip that would wait until it was done loading.
THANKS ALL
MCM
FileReference.onComplete Problem
I am using the fileReference class to upload images, but for some reason the onComplete listener just isn't working. It doesn't seem to be fireing at all.
To compensate for this, I added the following to the onProgress listener:
if(percentComplete >= 100){ action()}
But after reading more about the class, the onProgress doesn't fire if the file being uploaded is small. I've attached the code below. If there is anyone who can help me I'd really appreciate it.
Attach Code
listener.onProgress = function(file:FileReference, bytesLoaded:Number, bytesTotal:Number):Void {
var p = Math.round(bytesLoaded/bytesTotal*100);
uploaderMc.preloader.bar._xscale = p;
uploaderMc.feedback.text = "Uploading " + file.name +" "+ p + " Complete";
if(p >= 100){
uploaderMc.gotoAndStop("complete");
var filePath = "http://www.amorphicdesign.com/xdphoto/images/"+file.name;
delayInterval = setInterval(downloadImage, 1000,filePath);
}
}
// The listener object listens for FileReference events.
// the file is starting to upload.
listener.onOpen = function(selectedFile:FileReference):Void {
//uploaderMc.preloader.bar._xscale = 0;
delayCounter = 0;//resets the delayCounter for downloading
};
//DOESN'T WORK FOR SOME REASON???
// the file has uploaded
listener.onComplete = function(selectedFile:FileReference){
trace("onComplete: " + selectedFile.name);
}
listener.onHTTPError = function(file:FileReference, httpError:Number):Void {
//imagePane.contentPath = "error";
uploaderMc.feedback.text = "HTTPError number: "+httpError +"
File: "+ file.name;
};
listener.onIOError = function(file:FileReference):Void {
//imagePane.contentPath = "error";
uploaderMc.feedback.text = "IOError: "+ file.name;
};
listener.onSecurityError = function(file:FileReference, errorString:String):Void {
//imagePane.contentPath = "error";
uploaderMc.feedback.text = "SecurityError: "+SecurityError+"
File: "+ file.name;
};
imageFile = new FileReference();
imageFile.addListener(listener);
FileReference OnComplete Is Not Returned
Hi,
The last few days I'm struggling to get a file-upload working. My testfiles worked fine but since I embedded the file-upload into a bigger project it's not working the way I would like it to.
I'm using the fileReference class (and PHP) to upload and the file acutally gets uploaded into the directory I want it to, but the onComplete-method never shows up in my Flash-movie (neither is the onProgress for that matter). This is very annoying because I need it to fire other scripts if the upload succeeded.
I suppose it has something to do with the fact that the swf that handles the upload is loaded into another swf using the MovieClipLoader class. Does anybody know how this onComplete-method works with an swf loaded into another swf? I mean where is this return-value (can I call it that?) going? Obviously it's not arriving at the swf where the listener resides.
Any suggestion is much appreciated.
Sabine
Caurina Tweener OnComplete Help?
I have been adding simple transitions to a site Im making. They simply scroll up from the bottom on loading. One file uses a scroller I found a link to here on kirupa.com(from some rock band site).
Heres the tweens, non working onComplete and scroller script.
Code:
import caurina.transitions.Tweener
content_mc._alpha = 0;
content_mc._y = 475;
setY = function(mc, newY) { mc._y = newY; }
Tweener.addTween(content_mc, {_y:15, time:2, transition:"easeOut", rounded:true});
Tweener.addTween(content_mc, {_alpha:100, time:1, transition:"linear"});
Tweener.addTween(content_mc, {_blur_blurY:50});
Tweener.addTween(content_mc, {_blur_blurY:0, time:2, onComplete:setY, onCompleteParams:[content_mc, 15]});
fscommand("allowscale", "false");
bar.useHandCursor = dragger.useHandCursor=false;
space = 20;
friction = 0.9;
speed = 4;
y = dragger._y;
top = content_mc._y;
bottom = content_mc._y+mask_mc._height-content_mc._height-space;
dragger.onPress = function() {
drag = true;
this.startDrag(false, this._x, this._parent.y, this._x, this._parent.y+this._parent.bar._height-this._height);
dragger.scrollEase();
};
dragger.onMouseUp = function() {
this.stopDrag();
drag = false;
};
bar.onPress = function() {
drag = true;
if (this._parent._ymouse>this._y+this._height-this._parent.dragger._height) {
this._parent.dragger._y = this._parent._ymouse;
this._parent.dragger._y = this._y+this._height-this._parent.dragger._height;
} else {
this._parent.dragger._y = this._parent._ymouse;
}
dragger.scrollEase();
};
bar.onMouseUp = function() {
drag = false;
};
moveDragger = function (d) {
if ((dragger._y>=y+bar._height-dragger._height && d == 1) || (dragger._y<=y && d == -1)) {
clearInterval(myInterval);
} else {
dragger._y += d;
dragger.scrollEase();
updateAfterEvent();
}
};
up_btn.onPress = function() {
myInterval = setInterval(moveDragger, 18, -1);
};
down_btn.onPress = function() {
myInterval = setInterval(moveDragger, 18, 1);
};
up_btn.onMouseUp = down_btn.onMouseUp=function () {
clearInterval(myInterval);
};
MovieClip.prototype.scrollEase = function() {
this.onEnterFrame = function() {
if (Math.abs(dy) == 0 && drag == false) {
delete this.onEnterFrame;
}
r = (this._y-y)/(bar._height-this._height);
dy = Math.round((((top-(top-bottom)*r)-content_mc._y)/speed)*friction);
content_mc._y += dy;
};
};
Everything works fine except the onComplete which I simply want to set the _y pos of the mc to 15 after the transitions are complete so that the scroller script doesnt think the mc is at a _y position of 475.
I think I have the syntax for the onComplete and my setY function added correctly. Can anyone see the problem with this? Or another way to acheive what Im looking for?
TIA
OnComplete Function Call
Ola Senors e senoritas!
I've got this problem which has made me go all emo
If you create a class in as3, for instance:
I have a file called rootHandler.as with the following call
var myClass = new wootClass()
How do you get wootClass to call a function inside rootHandler.as once it's completed, say loading some XML? Hence I want the class to revert back to rootHandler.as once it has completed some task by calling a specific function in that parent.
If anyone can help it will be the awesomeness. Thanks!
Tweener OnComplete Not Listening
ActionScript Code:
private function buttonPushed (evt:MouseEvent) : void { Tweener.addTween (someText, { time:4, y:30, onComplete:moveleft()} );}private function moveleft(){ Tweener.addTween (someText, { time:0.5, x:-300} );}
I want the someText to move down then left after it has moved down, but the onComplete is not being triggered when the 4 seconds is up, but moveLeft function is firing at the same time as the first function why so? cant see what im doing wrong...
Video OnComplete And Subtitles
I'm using the FLV Playback component to load an external FLV file that has cue points in it. The cue points drive some animation on the main timeline.
In addition, I created a movie clip that I synched with the audio of the video displaying subtitles.
What I want to do is to have the movie _visibility turned off when it is complete. I also want to make sure that the subtitles mc only starts when the video starts so that it synchs with the video's audio.
Is there a way to do this? I don't see any behaviors for this type of functionality.
Fuse OnComplete Problem
I'm having an issue with the Proxy class, and the Fuse class....here's the code so far...
Code:
public function newSize(w:Number, h:Number):Void {
//
// new x and y positions ---------------------------------------
var leftX:Number = -(w/2);
var rightX:Number = w/2;
var topY:Number = -(h/2);
var bottomY:Number = h/2;
// -------------------------------------------------------------
//
fListener.onComplete = Proxy.create(this, stopTween, "completed");
fTween = new Fuse();
fTween.push([{target:topLeft, x:leftX, y:topY, time:tTime, ease:"easeInOutExpo"}, {target:topRight, x:rightX, y:topY, time:tTime, ease:"easeInOutExpo"}, {target:bottomRight, x:rightX, y:bottomY, time:tTime, ease:"easeInOutExpo"}, {target:bottomLeft, x:leftX, y:bottomY, time:tTime, ease:"easeInOutExpo"}]);
fTween.start();
fTween.addEventListener("onComplete", fListener);
frameClip.onEnterFrame = Proxy.create(this, drawPaper);
}
public function stopTween(theState:String):Void {
delete frameClip.onEnterFrame;
trace(typeof(theState));
fTween.stop();
fTween.removeEventListener("onComplete", fListener);
dispatchEvent({type:"onResize"});
}
The problem is that when this code is checked for errors, no errors occur....HOWEVER, when I run the code, 'theState' in the stopTween() function returns as an object...I did a trace and it looks like it might be returning the onComplete function object instead of the string "completed"....any thoughts?
Retrieving Php Output On FileReference.onComplete
Code:
//php uploader
$target_path = "/user/toto.jpg";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $target_path))
{
$status = "1";
}
else
{
$status = "0";
}
print("&status=$status");
In the FileReference.onComplete method, how can I retrieve the &status variable printed in the php file. It would make no sense to have no way to retrieve this data.
thx
Martin
File Upload OnComplete Failing
I'm using the FileReference.browse method to allow users to uplodd an .mp3 to a script. I am using AS2, publishing to Flash8. I am looking for and logging events ... when I first created this the oncomplete returned success and the file uploaded fine. Somewhere along the line oncomplete started to fail, yet the file still uploads. However now the flash player continues to attempt to open the file it seems, as my CPU pegs with seconds and the browser hangs. I can't see that I changed any code in the browse method, which I grabbed directly from Flash Help. I had changed the oncomplete to onCompleteData but that's not working either. Any thoughts out there?
Here is an example of what I mean (please have an mp3 ready to upload. Here's one if you need it.):
http://www.pokerxfactor.com/swf/mp3uploadtest.html
Thanks! any help would be appreciated
Here is the code:
----------------------------------------
Attach Code
import flash.net.FileReference;
var test_sound:Sound = new Sound();
// The listener object listens for FileReference events.
var soundListener:Object = new Object();
var memberid=3;
var handid=12345;
var handnum=1;
var index=3;
var firstPlay:Boolean=false;
var save=1; // 1: saves on pxf server then ftp's to multicast; 0: ftp to multicast only
var audioURL = "http://www.pokerxfactor.com/tempAudio/" + memberid + "-" + handid + "-" + handnum + "-" + index + ".mp3";
//if (save == 0) {
//audioURL = "http://mindwise.edgeboss.net/download/mindwise/audio/" + memberid + "-" + handid + "-" + handnum + "-" + index + ".mp3";
//}
// When the user selects a file, the onSelect() method is called, and
// passed a reference to the FileReference object.
soundListener.onSelect = function(selectedFile:FileReference):Void {
// Update the TextArea to notify the user that Flash is attempting to
// upload the image.
statusArea.text += "Attempting to upload " + selectedFile.name + "
";
// Upload the file to the script on the server.
var uploadurl = "http://www.pokerxfactor.com/scripts/pokerxfactor/audioupload.cgi?memberid=" + memberid + "&handid=" + handid + "&handnum=" + handnum + "&index=" + index + "&save=" + save;
trace(uploadurl);
selectedFile.upload(uploadurl);
};
// When the file begins to upload the onOpen() method is called, so
// notify the user that the file is starting to upload.
soundListener.onOpen = function(selectedFile:FileReference):Void {
statusArea.text += "Opening " + selectedFile.name + "
";
};
// Once the file has uploaded, the onComplete() method is called.
soundListener.onComplete = function(selectedFile:FileReference):Void {
statusArea.text += "Uploaded: " + selectedFile.name + "
... click play
";
};
// Once the file has uploaded, the onComplete() method is called.
//soundListener.onUploadCompleteData = function(selectedFile:FileReference, success:String):Void {
//if (success == "1") statusArea.text += "Uploaded: " + selectedFile.name + "
... click play
";
//else statusArea.text += "Upload of" + selectedFile.name + " failed. Please try again.
";
//};
var soundFile:FileReference = new FileReference();
soundFile.addListener(soundListener);
addAudioBtn_mc.onRelease = function() {
uploadSound();
}
// When the user clicks the button Flash calls the uploadSound() function,
// and it opens a file browser dialog.
function uploadSound(event:Object):Void {
soundFile.browse([{description: "Sound Files", extension: "*.mp3"}]);
}
play_btn.onRelease = function() {
if (testNow) {
if (!firstPlay) { //if user stopped in middle of audio
//send to position from stop
//_root.test_sound.start();
}
} else {
_root.test_sound.loadSound(audioURL, true);
}
}
stop_btn.onRelease = function() {
_root.test_sound.stop();
//record position
}
OnComplete With Fuse/Zigo Tween
Hello,
This is my first post and my first day even touching actionscript beyond the typical behaviors such as buttons or loading an external movie.
I trying to learn tween via AS. Fuse first and then Tweener. I'm not sure which is easier to learn, but neither have a 'dummies' book and constructors, events, objects and hoot-nanny just confuse me.
I have a series of tweens using Fuse and at the end I want it to go to frame three, but not before. See below:
Code:
import com.mosesSupposes.fuse.*;
ZigoEngine.simpleSetup(Shortcuts,PennerEasing,Fuse);
// start faded down with alpha of 0
textMenu._alpha = 0;
// fade to 100, over 1 second with a 1 second delay
textMenu.alphaTo (100,1,"easeOutBack",1);
// start faded down with alpha of 0
bg_radialGrey_mc._alpha = 0;
// fade to 100, over 1 second with a 1.5 second delay
bg_radialGrey_mc.alphaTo(100,1,"easeOutQuad",1.5);
// start faded down with alpha of 0
ftrTag_mc._alpha = 0;
// fade to 100, over 1 second with a 2 second delay
ftrTag_mc.alphaTo(100,1,"easeInQuad",2);
// go to next frame onComplete, but I'm not sure how, its all Greek to me
gotoAndStop(3);
The tweens work perfectly, its great not to mess with the timeline for the simple stuff, but everything basically runs at the same time.
I'd appreciate your help or any direction you could give and if you know of a site that has detailed examples. Notice I have to comment my code like crazy or I get lost.
Thank you and have a great weekend.
Problem With ScrollPane Component - OnComplete()
how do i update the scrollPane component instance, spFullPic,
so that the scroll bars adapt to whatever size the picture, full3.jpg is?
this is the current script:
loadMovie("picfiles/gallery3/full3.jpg", _level0.spFullPic.spContentHolder.mcPicHolder);
_root.spFullPic.onComplete();
FileReference.upload OnComplete Event Fails On OSX
hi
I have a flash 8 movie that upload jpegs to a server side script. When hosted
on an NT server, with a php script that recieves the upload, the FileReference
onComplete event gets called correctly when the an image has completely
uploaded using FileReference.upload. This when movie is viewed in Flash Player
8, in IE and Firefox on Windows XP and on OSX.
When the same swf is uploaded to an Apache Tomcat/5.5.12 server, with a jsp
script to recieve the upload, then the problems start. The upload works ok on
both PC and OSX, except that the onComplete event of the FileReference object
is never called on OSX. The file itself does upload ok. It is essential to trap the onComplete event for the
site to continue with its functionality.
Although the onCOmplete event does not work, the onProgress event does fire, if the file takes long enough to
upload (more than a few fractions of a second). However, as it does not fire if the file upload very quickly I cannot rely on it to work out when the file has completeds uploading.
Has anyone come across this problem or similar?
TIA
Joe Lister
FileReference OnComplete Event Handler Fires Too Soon
Dear all,
We are trying to use Flash 8's FileReference API to upload the big media files in our web app.
In our application we upload big media file first to some transient server and then immediately in the same uploading process we start moving this file to Amazon S3 file storage server.
The whole uploading process for big media file can be accomplished within 100 seconds, 200 seconds or even 10 000 seconds on slow connections.
Important note:
Only after the WHOLE upload process finishes, HTTP status code 200 is sent from the server to the Flash player.
Unfortunately, for some reason, FileReference 'onComplete' event handler ALWAYS fires after aprox.10-15 sec of time, regardless the fact that HTTP status code 200 is sent from the server after 100 seconds, 200 seconds and even 10 000 seconds.
Why is that?
Accordingly to Flash 8 livedocs, FileReference onComplete event handler fires ONLY when Flash Player has received an HTTP status code of 200 from the server . http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00002215.html
--
With flex regards,
JabbyPanda
Firing Name
hi!
It s nice. Here i have firing name just go through it and give feed back. How is it ?
rajesh
Open File After Download OnComplete (File.reference)
I would like to be able to open a file after it downloads using File.reference. Has anybody done this? I know when I download files from other sites I am prompted to either save or to open, I would like to be able to do this.
Any thoughts?
Thanks!
John
Firing A Bullet
i have a crosshair target that i can move about my screen with the cursor keys.
What i want is for when i press the space bar i want a bullet movieClip, that is located at the bottom of the screen in the middle, to fired towards the target crosshair.
I cant quite figure how i am going to move the bullet's x and y cordinates so that it goes exactly towards the target when the space bar is pressed
so far i have
=======================================
if (Key.isDown(Key.SPACE)){
bulletTargetX = getProperty(_root.cross.target, _x);
bulletTargetY = getProperty(_root.cross.target, _y);
NowX=getProperty(_root.ship, _x);
Nowy=getProperty(_root.ship, _y);
=======================================
this sets the target x and y coordinates for my bullet. The bullet will be fired from variable positions NowX and NowY.
The above code is within an onClipEvent (enterFrame)
any suggestions
thanks in advance
gilesb
External Swf's Not Firing
I've got a movie that calls external swf's to be loaded. It works when I try it on my computer (in the Flash viewer) but when I upload to the server the external swf's aren't fired.
Everything is uploaded (all swf's are on the server in the root directory) and the buttons work (locally in the viewer anyway)
Any suggestions; this is killing me.
View my site
When you click on "About me" in the bottom right, it fires an external MC (about.swf) When you click on one of the buttons in about.swf it should fire another swf based on what button is pressed. I know it works because I can play it on my machine, but not on the server. Here's my code for the first button (information):
on (release) {
unloadMovie ("Aboutme.swf");
unloadMovie ("Skills.swf");
unloadMovie ("Education.swf");
unloadMovie ("History.swf");
unloadMovie ("inspirations.swf");
loadMovie ("information.swf",_root.holder);
}
//where holder is the empty movie clip I'm trying to load into
OnUnload Not Firing
I have some movie clips in a frame that use intervals to randomly update them selves. As intervals are a horrible pain in the neck if they try to run when the clip is no longer there these clips have an onUnload event that clears the intervals. This works fine when I simply navigate to another frame with gotoAndStop().
However when I log off I have to send a call to the backend and wait for a response. I then use gotoAndStop to go to the log in frame. When I do this the onunload events do not fire and the intervals fire and make the whole screen go white.
Why aren't these onUnload events firing? Can anyone help?
Thanks
Firing Spaceship Gun
Does anyone know how to make a spaceship fire when your press Space Bar? If anybody knows the actionscript for it and where you would put it, please tell me. Thanks!
Firing From A Tank?
I have been on and off using flash in the past few weeks and have mostly been following the great tutorials from this site. I have started a tank game ( you look from above and the tanks move in all directions). Up to now it has been more of a racing game but I really want to have those tanks shoot at each other in a 2 player game. The problem is as follows:
I have the tank as a MovieClip that can move but it is the rocket/missile that I can't make work. I have been looking round and the only tutorial is that of a unilateral movement with the missile moving along the y axis.
I wonder if the isn't a way for the missile ( hidden at start under the tank) that can take the tank's orientation and just move along that orientation ( or copy of it). I am too newbie like to know what all the actions are in Flash.
So any body have an idea, I'll keep on trying but may be stuck shortly.
THX, SebOr
Firing From A Tank?
I have been on and off using flash in the past few weeks and have mostly been following the great tutorials from this site. I have started a tank game ( you look from above and the tanks move in all directions). Up to now it has been more of a racing game but I really want to have those tanks shoot at each other in a 2 player game. The problem is as follows:
I have the tank as a MovieClip that can move but it is the rocket/missile that I can't make work. I have been looking round and the only tutorial is that of a unilateral movement with the missile moving along the y axis.
I wonder if the isn't a way for the missile ( hidden at start under the tank) that can take the tank's orientation and just move along that orientation ( or copy of it). I am too newbie like to know what all the actions are in Flash.
So any body have an idea, I'll keep on trying but may be stuck shortly.
THX, SebOr
Laser Firing Help
I am making a flash game, but I have a problem.
The controls are as follows:
Up Arrow: Rotate upwards
Down arrow: Rotate downwards
Right arrow: Accelerate
Left arrow: Decellerate
CTRL: Boost
Space: Fire
When my ship fires, I want it to fire out of the ship, not just move to the right of the screen.
Also, my boundries are not working correctly
The MCs are below:
Ship= XWinga
Boundries: land
Laser= laser
The instances are named the same as their MCs are named.
Code for the Xwing:
code: onClipEvent(load)
{
speed =0 ;
_root.laser._visible=false;
laserCounter=1;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.SPACE)) {
laserCounter++;
_root.laser.duplicateMovieClip( "laser"+laserCounter, laserCounter );
_root["laser"+laserCounter]._visible=true;
}
if (Key.isDown(Key.RIGHT)) {
speed += .3;
}
else if (Key.isDown(Key.LEFT)) {
speed -= .3;
}
// Wee!
if (Key.isDown(Key.UP)) {
_rotation -= 2;
}
if (Key.isDown(Key.DOWN)) {
_rotation += 2;
}
if (Key.isDown (Key.CONTROL)) {
speed += 1;
}
speed *= .99;
x = Math.sin(_rotation*(Math.PI/180))*speed;
y = Math.cos(_rotation*(Math.PI/180))*speed*-1;
if (!_root.top.hitTest(_x+x, _y+y, true)) {
_x += x;
_y += y;
} else {
speed *= -25;
}
}
Code for laser:
code: onClipEvent (load) {
laserMoveSpeed=20;
this._y=_root.XWinga._y;
this._x=_root.XWinga._x+80;
this._rotation=_root.XWinga._rotation;
}
onClipEvent (enterFrame) {
this._y=_root.XWinga._y;
this._rotation=_root.Xwinga._y;
this._x+=laserMoveSpeed;
if (this._x>600){
if (this._y>450) {
this.removeMovieClip();
}
}
}
Any help would be greatly appreceated.
*added AS tags for clarity:
http://www.flashkit.com/board/showth...hreadid=584396
gparis
[F8] Help Firing Bullets
Hey guys, I'm having some trouble getting my ship to fire its bullets in my game. I'm following a tutorial given to me by my tutor and I think I've followed it perfectly so I don't understand what's going on. The files are attached.
Can anyone help?
Thanks
Pete
Bullet Firing
bullet firing mechanisms problem
Ok, I am going to do a bit of a side project until my lazy friend gets over here to work on the starship game. So, it's a simple stick figure side scrolling game. You have a character on the left, you have smaller people coming from the right. You ned to shoot them in order to make them go away. Yet they shoot back at you. so here's my questions:
1. How to get the bullet to fire from your character's gun when you press a button? i tried the tutorial but it didn't work for MX.
2, to get the enemies to fire at random, how would I go abot this.
Thanks in advance!
Later,
FF
Function Firing On Its Own
First time using AS 3.0 and I'm running into a problem with something that seems extremely simple... I tried following an example of how to create a Play button and I inserted the following code into the first keyframe of my movie:
Code:
stop();
function startMovie(event:MouseEvent):void
{
this.play();
}
playButton.addEventListener(MouseEvent.CLICK, startMovie);
For some reason the startMovie function is firing on it's own even when the playButton isn't clicked.
If I remove the event listener the movie stops at the first frame and displays the playButton. When I put the event listener back, as soon as the movie starts it passes the first frame and continues to play the movie.
Anyone know what's wrong?
Thanks in advance,
Tommy
Mouse_out Not Firing
So i have a simple button implemented via an MC. I have event handlers registered for the MOUSE_OUT and MOUSE_OVER events such that a little animation plays when the mouse hovers over and when the mouse exits my button. My initial problem was that the MOUSE_OUT event would sometimes fail to fire, leaving the MC in the MOUSE_OVER state. I did some searching and found that you could look at the target.toString of the event, and if the current target isn't the MC then play the same frames from the MC as you would on MOUSE_OUT. This solved the MOUSE_OUT failed to fire problem, but caused a new one. Now my MOUSE_OVER animation doesn't play properly, it just skips to the last frame. It looks to me that my code to check for if the current target has changed is firing before my MOUSE_OVER animation has completed, causing it to skip to its end prematurely. Anyhow, here's my code so far:
addEventListener(MouseEvent.MOUSE_OUT, myMouseOut);
addEventListener(MouseEvent.MOUSE_OVER, myMouseOver);
function myMouseOver(event:MouseEvent):void {
gotoAndPlay(2);
if (event.target.toString() != "TABBUTTON_MC_1)"){
gotoAndPlay(21);
}
}
function myMouseOut(event:MouseEvent):void {
gotoAndPlay(21);
}
Firing A Projectile HELP
I have made a turret which rotates using the mouse as a targeting reticle. I'm having trouble with clicking the mouse and a projectile firing from the turret and stopping where the mouse was clicked. Any help welcome.
OnLoadComplete Not Firing...
Hi:
Iīm trying to build a photo slide that "auto-advances" using an interval. So when I call the interval to show the next pic, I check if the next one is loaded.
When testing it locally, the onComplete (also tried onInit) work fine, but when testing on the server, the onLoadComplete doesnīt fire. I know the pic is loaded (I use web speed simulator and can see that the jpg is loaded), but the event doesnīt fire.
Any help would be greatly appreciated, Iīm stuck.
Hereīs part of the code.
Code:
var imgLoader = new MovieClipLoader();
var imgNum = 0;
// la defino ahora, porque al aņadirle clips y fotos se jode el alto y no se centran
var master_alto=this._height
function loadImg(){
imgNum = my_secc.numfotos;
//trace(imgNum);
//Create the instance name for the movieclip to hold the image
imgMcName = "img" + imgCurLoad + "_mc";
if(imgCurLoad <= imgNum){
this.createEmptyMovieClip(imgMcName, this.getNextHighestDepth());
eval(imgMcName)._alpha =0;
imgLoader.loadClip(folder+"/" + imgCurLoad + ".jpg",imgMcName);
}
}
imgLoader.onLoadComplete = function(target_mc:MovieClip){
traceAlert("target_mc "+target_mc)
traceAlert("photo number loaded "+imgMcName.substr(3,1));
if(imgCurLoad == 1){
eval(imgMcName)._alpha = 100;
imgSelected = imgCurLoad;
//this is the interval that shows the next pic. It hides the previous and fades in the next one
auto_foto=setInterval(pict_av,Number((fotodelay+fade_largo)*1000))
}
//Incriment imgCur for the next load, and start the process again
imgCurLoad++;
loadImg();
}
OnEnterFrame Only Firing Once
The following is on the _root timeline:
ActionScript Code:
var container:MovieClip = this.createEmptyMovieClip("container", this.getNextHighestDepth());
for (var a in imagePaths) {
var fallingImage:MovieClip = imagesContainer.createEmptyMovieClip("img" + a, imagesContainer.getNextHighestDepth());
fallingImage._x = Math.random() * Stage.width;
fallingImage._y = (Math.random() * 80) - 160;
fallingImage.loadMovie(imagePaths[a]);
fallingImage._xscale = fallingImage._yscale = 25;
fallingImage.onEnterFrame = function() {
this._y += 5;
trace(this);
}
}
The movieclips are loading the images as requested and they're appearing on the stage. But the onEnterFrame handler is firing only one time for each movieclip generated in the loop. In it, the _y values of the mcs update as they should, the trace works properly, but the handler never fires again, therefore, the _y value isn't updating (and the mcs aren't "falling") as they should. It shouldn't be a scope issue. At least I don't think it is.
Why isn't this working right? I've never had this happen before and I can't make sense of it.
MC's Firing Towards The User
Hello,
I'm struggling with some code for a game I am making. I want a movieclip to move across the screen and for that movieclip to shoot an arrow at the player. Where the movieclip shoots from should be random and I want the arrow to come towards the centre to the screen and not have any horizontal movement (which I keep getting when it fires from the moving MC).
Can anyone help me out at all with any of the code I need here as it's starting to drive me nuts!?
Thanks very much,
Pnub
|