Re: [Flashcoders] [AS3] Sound Object Overlays
Hi Helmut, This looks more like an issue of lingering variables, or a queue that is not properly re-initialized at the pause, than of a problem with the Sound Object . How are you storing the references to the sounds? How are you controlling the sequential playing of the sounds? Bob Helmut Granda wrote: I am having a dilema with the sound Object. I have a player that plays sounds in certain order, when the user resets the movie the sounds play again. The issue is that somewhere the Sound Object remembers what sound was in queue thus when you reach certain point your old sounds play. for example play 1, 2 , 3 (pause) reset play 1, 2 (overlaps 3 ), 4 (overlaps 5).. and so forth. when the user resets the movie I stop the soundChannel but still I get this weird behavior and I was wondering if some one else has run on something similar or some guidance in better control of the sound object. TIA ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] [AS3] FileReference.download()
Hi Ntasky, I'm not sure if this is the only cause to the problem, but I did notice this. Your _onDownLoad handler is using _fileLocation, which is not defined anywhere in your code. hth, Bob ntasky wrote: Hi. simply trying to download files such as .zip or .pdf. The dialog box which tells me wher i want to download the file appears, i click OK, the dialog box closes and nothing is downloaded. files are on the same server. Did someone has a similar issue ? thx, N. here is my code: package { import flash.display.MovieClip; import flash.display.SimpleButton; import flash.events.MouseEvent; import flash.net.FileReference; import flash.net.URLRequest; import flash.events.IOErrorEvent; public class FileListItem extends MovieClip { private var _fileToDownload:FileReference; public function FileListItem(p_fileLocation:String) { _fileToDownload = new FileReference(); btDownload.addEventListener(MouseEvent.CLICK, _onDownload); }; private function _onDownload(p_evt:MouseEvent):void { _fileToDownload.addEventListener(IOErrorEvent.IO_ERROR, _onIOError) _fileToDownload.download(new URLRequest(_fileLocation), _fileLocation); } private function _onIOError(p_evt:IOErrorEvent):void { trace (p_evt); } } } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Passing vars with the the timer and events
Hi Helmut, One option is extending Timer such that it dispatches your custom SoundTimerEvent rather than the built in TimerEvent. Another option, if _sound is a class var, would be to have your timeEventHandler dispatch the SoundTimerEvent. hth, Bob Helmut Granda wrote: I have a custom TimerEvent that I am using to pass some information when the timer is up. My issue is that I dont need to pass the information until the time is up but how can i pass the information to a timer that is not available yet? The basic setup is something like this: public function myFunc ( varToPass : String, delay : Number = 0 ) { if ( delay 0 ) { globalTimer = new Timer ( delay, 1) globalTimer.start(); globalTimer.addEventListener ( TimerEvent.Timer, timerEventHandler) } else { dispatchEvent ( new SoundTimerEvent ( SoundTimerEvent.PLAY_VO , _sound ) ) ; } } private function timeEventHandler ( te : TimerEvent ) { // More stuff here } if no delay is added the event gets dispatched properly and everything moves great but how would I add or pass a variable through the globalTimer so that when the timer is up I can catch the _sound property? Any ideas? TIA ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Re: AS2 vs. AS3: instantiate library symbols with a loop string concatenation
Hi Jonathon, Your AS2 method is tried and true. Here's the new and improved AS3 way of doing it. for (var i:Number = 0; i 30; i ++) { // build the String name var symbol:String = sym + i; // locate the class var symbolClass:Class = getDefinitionByName(symbol) as Class; // instantiate the clip using the class var new_mc:MovieClip = new symbolClass() as MovieClip; // add clip to stage addChild(new_mc); // do stuff with clip } You may or may not need the as MovieClip bit on the instantiation, depending on how your class is actually defined. hth, Bob jonathan howe wrote: Sorry - somehow triggered the send mail hotkey before I was finished: On Tue, Mar 4, 2008 at 3:25 PM, jonathan howe [EMAIL PROTECTED] wrote: Imagine I have in my library a series of MovieClips with linkage identifiers like so: sym0 sym1 sym2 ... sym29 In AS2, if I wanted to create instances of each one (or perhaps decide which symbol to use based on XML data, for example), I could use a for loop: for (var i:Number = 0; i 30; i ++) { var new_mc:MovieClip = parent_mc.attachMovie(sym + i, sym + i, i); // do stuff with clip } and create each symbol via passing a concatenated string as symbolName. Now, in AS3, I can't think of a way to do this efficiently. In our simple example, I can only think of the following: for (var i:int = 0; i 30; i ++) { var sym:MovieClip; switch (i) { case 0: sym = new sym0(); case 1:sym = new sym1(); case 2: sym =new sym2(); ... } // do stuff with clip } Is there a more efficient way to do this in AS3? You can't really instantiate a class based on a stringname, can you? Was I doing myself a disservice by using this technique in AS2 anyway? Thanks, -jonathan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] frame rate guidelines
Hi Dave, Probably the best guideline to use for frame rate is the capacity of your end users' machines, that and the fact that the Stage.frameRate setting is a speed limit, not a guarantee. The processor capacity and the complexity of your swf in terms of processor usage (calculations, redraws, etc.) will determine what speed is actually reached. If you are doing a lot of animation, you'll want a reliable frame rate for your intended users. If you're doing forms only, frame rate is nearly irrelevant. 15 fps is reliable for most programs running on all but the slowest machines. 30 fps is reliable on most modern machines. If your program is fairly easy on the processor and your expected users have faster machines, 60+ is probably ok, but you may want to allow for the cases where that speed is not possible. Bottom line is, you're going to have to find your own balance in how much cool your users can afford. hth, Bob Dave Segal wrote: Are there any general guidelines about what frame rate to use when publishing an swf? Also, are there any techniques for adjusting the frame rate of an swf at runtime? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Question on garbage collection
Hi Jiri, I'm not sure which AS version you're using but here are some good links on garbage collection in AS3. http://www.bit-101.com/blog/?p=783 http://gskinner.com/blog/archives/2006/06/as3_resource_ma.html http://board.flashkit.com/board/showthread.php?t=756290 32000+ more links can be found by googling, Flash AS3 garbage collection. hth, Bob Jiri Heitlager wrote: Hello List, I have two classes Time and Clock, see below. To get good encapsulation, in the Time class I added a function called clone(). This returns a copy of the Time instance, instead of a reference to it. Now I run the code, using an interval that calls the Clock.getElepasedTime(). While watching the Memory I can see it build up. Does this mean that with every clone of the Time object it still holds a reference and therefore doesnt get deleted by the garbage collector. Hope somebody can enlighten me.. Jiri class Clock { private var startTime:Number; private var elapsedTime:Time; //constructor method function Clock(tTime:Time) { clockdata = new ClockData() startTime = getTimer(); } public function getElepasedTime() : Time { var elapsedMilliseconds:Number = getTimer() - startTime; var elapsedHours:Number= Math.floor( elapsedMilliseconds / 360); var elapsedSeconds:Number= Math.floor( elapsedMilliseconds / 1000); var elapsedMinutes:Number= Math.floor( elapsedSeconds / 60); elapsedSeconds = elapsedSeconds%60; elapsedMinutes = elapsedMinutes%60; if(elapsedTime == null){ elapsedTime = new Time(elapsedHours , elapsedMinutes , elapsedSeconds) }else{ elapsedTime.hour = elapsedHours; elapsedTime.minute = elapsedMinutes; elapsedTime.second = elapsedSeconds; } return elapsedTime.clone(); } } class Time { private var _hour:Number; private var _minute:Number; private var _second:Number; //constructor method public function Time(hour:Number , minute:Number , second:Number) { _hour = hour _minute = minute _second = second } public function get hour() : Number { return _hour } public function set hour(nHour:Number) : Void { _hour = nHour } public function get minute() : Number { return _minute } public function set minute(nMinute:Number) : Void { _minute = nMinute; } public function get second() : Number { return _second } public function set second(nSecond:Number) : Void { _second = nSecond; } public function serialize() : String { var minutePrefix:String = ( (_minute 10)? '0' : ''); var secondPrefix:String = ( (_second 10)? '0' : ''); var hourPrefix:String= ( (_hour 10)? '0' : ''); return String(hourPrefix+_hour+':'+minutePrefix+_minute+':'+secondPrefix+_second); } public function clone() : Time { return new Time(_hour , _minute , _second) } } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Yes or no: Moving one MC into another (AS2)
Hi Michael, I'm not sure at what point in your runtime you want to make the copy, but if these clips are all library symbols in the same fla and are exported for Actionscript, wouldn't this do it? B.attachMovie(A, myA, B.getNextHighestDepth()); B.myA.attachMovie(X, myX, B.myA.getNextHighestDepth()); hth, Bob Mendelsohn, Michael wrote: Hi list... I have movieclip A, which contains movieclip X. I also have movieclip B, with no children, and I want it to contain a duplicate of A.X. Is it possible to do this in AS2? Thanks, - Michael M. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] urgent angle problem
er...make that if (angle 0) { angle += 360; } Bob Leisle wrote: Hi Allandt, How about something like this? if (angle 0) { angle += 180; } hth, Bob Allandt Bik-Elliott (Receptacle) wrote: hi guys i have a problem that i need to sort out - i have a script that checks to see where the mouse pointer is in relation to a point of origin and then selects which frame from a group of 9 to show the problem i'm having is that if the angle is above 180 degrees, it swaps to negative numbers back down to 0 (go to http://www.19.5degs.com/element/215.php to see an example - in particular watch the text frame as you move) and i need to figure out how to make it a full 360 i've tried if (angle0) { angle = (-1*angle)+180; } but that's not right here is my code //image frame selector function changeFrame(clip:MovieClip, angle:Number):Void { // frame is receiving a wrong number above 180 degrees here // there are 9 frames so i want each frame to have 40 degrees (hence angle/40) var frame:Number = Math.round(angle/40); // visibleClip is a variable set on all clips (set in the mousemove below) to tell my script which clip is visible to make it invisible without having to loop through the other clips when there's a change clip[clip.visibleClip]._visible = false; clip[p+frame]._visible = true; clip.visibleClip = [p+frame]; } //mouse follower var mouseListener:Object = new Object(); mouseListener.lookAt = function(clip:MovieClip, originX:Number, originY:Number, watchX:Number, watchY:Number):Void { var adjside:Number = watchX - originX; var oppside:Number = -1*(watchY - originY); var angle:Number = Math.atan2(oppside, adjside); // in radians var angle:Number = Math.round(angle/Math.PI*180); // convert to degrees var angle:Number = -1*(angle); // invert changeFrame(clip, angle); } mouseListener.onMouseMove = function () { var watchX:Number = _xmouse; var watchY:Number = _ymouse; // there are 8 images that are trying to do this for (var i:Number=1; i9; i++) { var thisPerson:MovieClip = content_mc[person+i]; this.lookAt(thisPerson, thisPerson._x, thisPerson._y, _root._xmouse, _root._ymouse); } }; Mouse.addListener(mouseListener); hope you can help alz Allandt Bik-Elliott Receptacle t 01920 413 947 | m 07970 718 545 e [EMAIL PROTECTED] This e-mail is confidential and may be privileged. It is for the use of the named recipient(s) only. If you have received it in error, please notify us immediately. Please do not copy or disclose its contents to anyone, and delete it from your computer systems. Please note that information sent by e-mail can be corrupted. This e-mail has been prepared using information believed by the author to be reliable and accurate, but the Company makes no warranty as to its contents. Any opinions expressed are those of the author and do not necessarily reflect the opinions of the Company. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders --No virus found in this incoming message. Checked by AVG Free Edition.Version: 7.5.516 / Virus Database: 269.19.20/1260 - Release Date: 2/5/2008 9:44 AM -- Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] urgent angle problem
Hi Allandt, How about something like this? if (angle 0) { angle += 180; } hth, Bob Allandt Bik-Elliott (Receptacle) wrote: hi guys i have a problem that i need to sort out - i have a script that checks to see where the mouse pointer is in relation to a point of origin and then selects which frame from a group of 9 to show the problem i'm having is that if the angle is above 180 degrees, it swaps to negative numbers back down to 0 (go to http://www.19.5degs.com/element/215.php to see an example - in particular watch the text frame as you move) and i need to figure out how to make it a full 360 i've tried if (angle0) { angle = (-1*angle)+180; } but that's not right here is my code //image frame selector function changeFrame(clip:MovieClip, angle:Number):Void { // frame is receiving a wrong number above 180 degrees here // there are 9 frames so i want each frame to have 40 degrees (hence angle/40) var frame:Number = Math.round(angle/40); // visibleClip is a variable set on all clips (set in the mousemove below) to tell my script which clip is visible to make it invisible without having to loop through the other clips when there's a change clip[clip.visibleClip]._visible = false; clip[p+frame]._visible = true; clip.visibleClip = [p+frame]; } //mouse follower var mouseListener:Object = new Object(); mouseListener.lookAt = function(clip:MovieClip, originX:Number, originY:Number, watchX:Number, watchY:Number):Void { var adjside:Number = watchX - originX; var oppside:Number = -1*(watchY - originY); var angle:Number = Math.atan2(oppside, adjside); // in radians var angle:Number = Math.round(angle/Math.PI*180); // convert to degrees var angle:Number = -1*(angle); // invert changeFrame(clip, angle); } mouseListener.onMouseMove = function () { var watchX:Number = _xmouse; var watchY:Number = _ymouse; // there are 8 images that are trying to do this for (var i:Number=1; i9; i++) { var thisPerson:MovieClip = content_mc[person+i]; this.lookAt(thisPerson, thisPerson._x, thisPerson._y, _root._xmouse, _root._ymouse); } }; Mouse.addListener(mouseListener); hope you can help alz Allandt Bik-Elliott Receptacle t 01920 413 947 | m 07970 718 545 e [EMAIL PROTECTED] This e-mail is confidential and may be privileged. It is for the use of the named recipient(s) only. If you have received it in error, please notify us immediately. Please do not copy or disclose its contents to anyone, and delete it from your computer systems. Please note that information sent by e-mail can be corrupted. This e-mail has been prepared using information believed by the author to be reliable and accurate, but the Company makes no warranty as to its contents. Any opinions expressed are those of the author and do not necessarily reflect the opinions of the Company. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders --No virus found in this incoming message. Checked by AVG Free Edition.Version: 7.5.516 / Virus Database: 269.19.20/1260 - Release Date: 2/5/2008 9:44 AM -- Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] loadMovie from subdirectory - change base path
the movies from the screens subdirectory, and this works fine. But the problem is that the movies in the screens subdirectory often reference XML files (which also live in the screens subdirectory). All works well when you play the individual screenx.swf files, obviously, but when you play controller.swf, it is looking for the XML files in the same directory as itself (one directory up). How can I fix this problem so that playing controller.swf works fine, as well as playing each individual screenx.swf file in the screens subdirectory? Is this possible? It seems like such a simple idea, but I'm so stumped. I should mention that this project is not actually going online - it is going to be converted to an EXE using Zinc and distributed via CD. So I can't use absolute paths. Please! Heelp! Thanks! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] for statement stumper
Hi Dwayne, You're right it won't be the same. You need to store the value in each button, for retrieval when the functions are executed. Try something like this instead: for (var j = 0; j5; j++) { trace(j is+j); this[clip+j][button+j].nbrID = j; this[clip+j][button+j].onRollOver = onClipRollOver; this[clip+j][button+j].onRollOut = onClipRollOut; } onClipRollOver = function() { Tweener.addTween(this._parent,{_xscale:100, _yscale:100, delay:0, time:2}); Tweener.addTween(_root[text+ this.nbrID],{_alpha:100, delay:0, time:2}); _root.touchedButton = true trace(nbrID: +this.nbrID); }; onClipRollOut = function() { Tweener.addTween(this._parent,{_xscale:50, _yscale:50, delay:0, time:2}); Tweener.addTween(_root[text+this.nbrID],{_alpha:0, delay:0, time:2}); _root.touchedButton = false trace(nbrID: +this.nbrID); }; hth, Bob Dwayne Neckles wrote: Gang here is a stumper for you.. When in the first trace statement j is 0 through 4 but in the second trace statement j is 4, 4 times... ive been playing with this for days.. so i guess the j value is not the same inside a nested function.. what can i do to make it the same? for (var j = 0; j5; j++) { trace(j is+j); this[clip+j][button+j].onRollOver = function() { Tweener.addTween(this._parent,{_xscale:100, _yscale:100, delay:0, time:2}); Tweener.addTween(_root[text+ j],{_alpha:100, delay:0, time:2}); _root.touchedButton = true trace(j is+j); }; this[clip+j][button+j].onRollOut = function() { Tweener.addTween(this._parent,{_xscale:50, _yscale:50, delay:0, time:2}); Tweener.addTween(_root[text+j],{_alpha:0, delay:0, time:2}); _root.touchedButton = false }; } _ Helping your favorite cause is as easy as instant messaging. You IM, we give. http://im.live.com/Messenger/IM/Home/?source=text_hotmail_join___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Problem targeting a movieclip
Hi Marcelo, You could store references to the clips in the array instead of String paths. Then you could access them directly with trace(text_area_array[1]); If you need help doing that, post the code you use to store the paths in the array. hth, Bob Marcelo Wolfgang wrote: Hi list, I'm trying to access multiple movieclips that path names are stored in an array, this array is populated with the names when an area load and its cleaned when an area unload. Here's the code I have so far: trace(thisRoot.areaLoader_mc.txt_galeria_mc); // if I delete this the next one traces undefined trace(thisRoot.areaLoader_mc.txt_galeria_mc.txt_img05_mc); // this is the full path, it works trace(text_area_array[1]) // txt_galeria_mc.txt_img05_mc (is a string) what I'm trying to do trace(thisRoot.areaLoader.text_area_array[1]) // undefined trace(eval('thisRoot.areaLoader.'+text_area_array[1])) // undefined Can anyone help me figure out how I can target my mc so I can run some stuff on it? TIA Marcelo Wolfgang ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] placing mc on the stage
Hi Pedro, Try this instead: Math.random()*500; Here's a simplistic but clear tutorial on the subject: http://animation.about.com/od/flashanimationtutorials/ss/mathrandom.htm hth, Bob Pedro Kostelec wrote: Hello i got this code: this.createEmptyMovieClip(canvas,this.getNextHighestDepth()); //creates an empty MC in which i attach 2 textMCs canvas._x = random500;//should place the MCs to a random position when they load but it doesn't work?!?-What is wrong here? canvas._y = random100; attachMovieInterval = setInterval(attachMovies, 200);//set interval for green mc reload function attachMovies() { for (var i = 0; i2; i++) { canvas.attachMovie(code,code+i,this.getNextHighestDepth()); canvas.code1._x = random500; canvas.code1._y = random100; canvas.code2._x = Stage.width/2; canvas.code2._x = Stage.height/2;//how do i do to define the x and y position of each mc separately? } } sorry for writing it so briefly. My keyboard doesn't work well and i cannot type a lot - -- Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Simple quesiton for createEmptyMovieClip in AS2
Hi (don't know your name, but I'm pretty sure it isn't macromedia :) ), There are a couple of issues in the code: 1. This line makes no sense: var url:String http://mail.google.com/mail/String = arrURLs[i]; I can't tell what you're trying to do with the, http://mail.google.com/mail/String. If you're trying to concatenate it to the URL from the array, then it should read, var url:String = http://mail.google.com/mail/String+arrURLs[i]; If you're just trying to access the URL in the array, then the line should read, var url:String = arrURLs[i]; 2. In this line, vidThumb = eval(vThumb+i); vidThumb will evaluate to this.vThumb0, or whatever number i equals. To get the correct path to the clip you're trying to reference, try this instead: vidThumb = _root[vThumb+i]; There are cases when eval() is the only way to get a piece of code working, but generally in Actionscript, using it is an indication that the code has taken a wrong turn somewhere. In AS3 eval() has been removed altogether. hth, Bob macromedia flash wrote: Hey Bob, as per your suggestion, I have done the code below, it seems has problem on this. Would you please help me to take a look? Have a nice day :) == var thumbHorizontalGap = 110; //var url:String http://mail.google.com/mail/String = http://img0.gmodules.com/ig/images//weather_welcome_image.jpg;; var arrURLs:Array = [ http://l.yimg.com/us.yimg.com/i/us/ga/gameart2/perilendhouse/perilendhouse-100.gif , http://l.yimg.com/us.yimg.com/i/us/ga/gameart2/sallyssalon/sallyssalon-100.gif , http://l.yimg.com/us.yimg.com/i/us/ga/gameart2/riseofatlantis/riseofatlantis-100.gif ] for (var i:Number = 0; i3; i++) { var url:String http://mail.google.com/mail/String = arrURLs[i]; _root.createEmptyMovieClip(vThumb+i,i+1000); vidThumb = eval(vThumb+i); vidThumb._y = i*thumbHorizontalGap; vidThumb.loadMovie(url); vidThumb.onRelease = function() { openURL(url); }; //trace(vidThumb); } function openURL(url) { getURL(url); } = On 1/13/08, Bob Leisle [EMAIL PROTECTED] wrote: You could put your URLs in an array and increment through it with each loop iteration, like this: var thumbHorizontalGap = 75; var arrURLs:Array = [http://img0.gmodules.com/ig/images//weather_welcome_image.jpg; , http://img0.gmodules.com/ig/images//some_image.jpg; , http://img0.gmodules.com/ig/images//someother_image.jpg; , http://img0.gmodules.com/ig/images//yetanother_image.jpg; , http://img0.gmodules.com/ig/images//onemore_image.jpg; ]; for (var i:Number = 0; i 5; i++) { var url:String = arrURLs[i]; _root.createEmptyMovieClip(vThumb+i, i+1000); vidThumb = eval(vThumb+i); vidThumb._y = i* thumbHorizontalGap; vidThumb.loadMovie(url) vidThumb.onRelease = function(){ openURL(url) } } macromedia flash wrote: AWESOME! thanks all :) One more question here... how can I assign URL link to each movieClip? I would like to add URL for each of movieClip which created by looping, the code like this Thank you var thumbHorizontalGap = 75; var url: String = http://img0.gmodules.com/ig/images//weather_welcome_image.jpg; for (var i:Number = 0; i 5; i++) { _root.createEmptyMovieClip(vThumb+i, i+1000); vidThumb = eval(vThumb+i); vidThumb._y = i* thumbHorizontalGap; vidThumb.loadMovie(url) vidThumb.onRelease = function(){ openURL(url) } } function openURL(url){ getURL(url); } = ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Preloading and Dispatching Events
Hi Helmut, The MovieClip inheritance chain looks like this: MovieClip - Sprite ../../flash/display/Sprite.html - DisplayObjectContainer ../../flash/display/DisplayObjectContainer.html - InteractiveObject ../../flash/display/InteractiveObject.html - DisplayObject ../../flash/display/DisplayObject.html - EventDispatcher ../../flash/events/EventDispatcher.html - Object. ../../Object.html Any class you write that extends MovieClip also inherits the ability to dispatch events. hth, Bob Helmut Granda wrote: Hi All, While creating a custom class I am trying to figure out a way to add the preloaded images at the same time as to dispatch an event to a different class when the images have loaded. of course I know that I cant extend a class to an EventDispatcher and to a MovieClip at the same time so I have to choose one, If I extend to an EventDispatcher then I cant add the clip when the images are preloaded. If I extend to a MovieClip then I cant Dispatch custom events to other listeners.. I was thinking of creating an Interface for the Event Dispatcher and then for the MovieClip once that is done then I could implement both interfaces but I dont think this is the right approach Any suggestions are welcome, Helmut ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Simple quesiton for createEmptyMovieClip in AS2
Try this instead: for (var i:Number = 0; i 5; i++) { _root.playListHolder.createEmptyMovieClip(vThumb+i, i+1000); var vidThumb = __root.playListHolder[vThumb+i]; //theVideo.width = thumbWidth; //theVideo.height = thumbHeight; vidThumb._y = i*thumbHorizontalGap+thumbY; vidThumb.loadMovie( http://www.google.com/http://img0.gmodules.com/ig/images//weather_welcome_image.jpg;); } Assuming your thumbHorizontalGap and thumbY vars are right, this should display 5 clips vertically; hth, Bob macromedia flash wrote: hi there, I am having problem to create empty Movie clicp by using the code below, I can't create 5 movie clips vertically. Would you please help me take a look this. Thank you so much :) playListHolder is an MC Instance name and placed on Stage. for (var i:Number = 0; i 5; i++) { var vidThumb:MovieClip = _root.playListHolder.createEmptyMovieClip(vThumb+i, i+1000); vidThumb = eval(vThumb+i) //theVideo.width = thumbWidth //theVideo.height = thumbHeight; vidThumb._y = i*thumbHorizontalGap+thumbY; vidThumb.loadMovie( http://www.google.com/ http://img0.gmodules.com/ig/images//weather_welcome_image.jpg;) } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] movieclip to movieclip control in AS3
Hi Gustavo , Check out DisplayObjectContainer.getChildByName() or getChildByIndex() in the Flash help or at http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/index.html?flash/display/DisplayObjectContainer.htmlflash/display/class-list.html hth, Bob Gustavo Duenas wrote: Hi Coders, long time no see! I have one movie clip, which has an order in the timeline. the order is : this.ball.gotoAndPlay(2); I've been trying: root.ball.gotoAndPlay(2); ball.gotoAndPlay(2); MovieClip(ball).gotoAndPlay(2); but no success at all...Am I'm doing wrong something? I've been Trying this is AS2 but is ok, but when I try to use this or the tellTarget in AS3, I got Nothing. Please help. Regards Gustavo A. Duenas ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders --No virus found in this incoming message. Checked by AVG Free Edition.Version: 7.5.516 / Virus Database: 269.19.1/1219 - Release Date: 1/11/2008 10:19 AM -- Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] movieclip to movieclip control in AS3
Hi Gustavo, If you're looking for AS3 books, Essential Actionscript 3.0 by Colin Moock is a great place to start. I'm a bit unclear what you're trying to do. If you are trying to start the ball clip from it's parent timeline, this should work: ball.gotoAndPlay(2); If you're trying to start it from inside another clip, and both ball and the calling clip are on the same timeline, this should do it: var clip:MovieClip = this.parent.getChildByName(ball) as MovieClip; clip.gotoAndPlay(2); hth, Bob Gustavo Duenas wrote: HI Bob, thanks but this is so obscure to me, there is an example about this someplaceI guess I should have bought an AS3 Book. Regards gustavo P.d: in AS@ is so easy but since we migrate to flash cs3 I'd like to have all the advantages of the AS3 but I don't get it something that simple as movieclip to movieclip control. On Jan 11, 2008, at 3:31 PM, Bob Leisle wrote: Hi Gustavo , Check out DisplayObjectContainer.getChildByName() or getChildByIndex() in the Flash help or at http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/index.html?flash/display/DisplayObjectContainer.htmlflash/display/class-list.html hth, Bob Gustavo Duenas wrote: Hi Coders, long time no see! I have one movie clip, which has an order in the timeline. the order is : this.ball.gotoAndPlay(2); I've been trying: root.ball.gotoAndPlay(2); ball.gotoAndPlay(2); MovieClip(ball).gotoAndPlay(2); but no success at all...Am I'm doing wrong something? I've been Trying this is AS2 but is ok, but when I try to use this or the tellTarget in AS3, I got Nothing. Please help. Regards Gustavo A. Duenas ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders --No virus found in this incoming message. Checked by AVG Free Edition.Version: 7.5.516 / Virus Database: 269.19.1/1219 - Release Date: 1/11/2008 10:19 AM --Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Gustavo A. Duenas Creative Director LEFT AND RIGHT SOLUTIONS 904. 265 0330 - 904. 386 7958 www.leftandrightsolutions.com Jacksonville - Florida ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders --No virus found in this incoming message. Checked by AVG Free Edition.Version: 7.5.516 / Virus Database: 269.19.1/1219 - Release Date: 1/11/2008 10:19 AM -- Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] OOP design books
Hi Erik, If the Lott/Patterson is not causing you sparks of understanding, the GoF book is probably not worth your money yet. It is good and thorough, but it's also dense, written like a university level text book, and focused on SmallTalk. I'd recommend re-reading the Lott/Patterson, as you suggested, and working through the examples instead. I found that I didn't really get it until I built some of their examples in Flash. Then it began to sink in. The Head First book is also very good and a bit more user-friendly, but you'll have to turn many extra pages to get through all the cute graphics and other filler to get to the really useful information. I haven't read the Sanders/Cumaranatunge yet so I can't comment on it. Good luck, Bob Mattheis, Erik (MIN - WSW) wrote: The information in the Lott/Patterson AS3 w/ Design Patterns is having trouble sinking into my head. I understand the patterns as they describe them, but I'm not getting much take-away. I don't put the book down thinking gee, I should use the iterator pattern in this app! Reading reviews, I'm thinking of getting the Sanders/Cumaranatunge AS 3 Design Patterns book as it appears to be much more thorough in introducing OOP concepts. I've also read reviews that suggest the HeadStart DesignPatterns for Java is the best design patterns book. Which makes me wonder why not get the original GoF book. Then again, maybe I should re-read the front material in the Lott/Patterson book. Suggestions? Erik J Mattheis Sr. Web Programmer Weber Shandwick Minneapolis, MN T: (952) 346 6610 | M: (612) 377 2272 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] central up to date data
Hi Tom, It's a bit hard to tell without seeing the code. If your app class and your menu class, etc. are each creating their own extension of utils, then how are those subclasses communicating? Are they calling some update function in the super class? It sounds like you need to use a singleton, and give it an update() method that any class can access. That way you know all your classes are updating the same instance. Here are great examples of singletons: http://www.gskinner.com/blog/archives/2006/07/as3_singletons.html Hope that helps, Bob Tom Huynen wrote: Hi List! I'm using a class named utils.as to store data like color values in my project. This class is then extended by let's say the application.as and the menu.as. Next in the application class I change the value of a var in the utils class. When retrieving this value from the third (menu) class I still get the old value instead of the new one. What is the best thing to do when I want to keep my data central, up to date and accesible for all classes in my project? Kind regards, Tom ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Detecting mouse events over non-white parts
My understanding is that it's the default behaviour of a clip with any mouse events handled at all, that the cursor changes when it enters the clip. Using useHandCursor, you could turn that feature off as the default, and then back on when you test positive for your viewable clip area. Something like this: clip.useHandCursor = false; clip.onPress = function(){ } clip.onEnterFrame = function(){ this.useHandCursor = (this.hitTest(_xmouse, _ymouse, true)); } hth, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] dynamically naming sound objects?
I can think of 2 possibilities causing your trouble: 1. By using 1 name for all your Sound objects, each one is over-writing the one before it. So what you end up with is 4 references to the same Sound, the last one in the loop. 2. It's possible that you're trying to play the sounds before they're completely loaded. I played with your code a bit and this works: code var mySounds:Array = new Array(); var sPath:String = ../mp3/; mySounds[0] = sPath+soundD_DIP_you_know_this_word.mp3; mySounds[1] = sPath+soundD_NAR_a.mp3; mySounds[2] = sPath+soundD_NAR_a_(art).mp3; mySounds[3] = sPath+soundD_NAR_a_capital_b_looks_like_this.mp3; var sounds_array:Array = new Array(); var sBaseName:String = sound; // load all sounds in loop function loadSounds() { trace(loadSounds); for (var i:Number = 0; imySounds.length; i++) { var sRef = _root; //var testSound:Sound = new Sound(sRef); this[testSound+i] = new Sound(sRef); var rfcSound:Sound = this[testSound+i]; rfcSound.onLoad = function(success){ if(success) { // prove the load is complete trace(this+: dur:+this.duration); } else { trace(Not loaded yet); } }; rfcSound.loadSound(mySounds[i], False); sounds_array.push(rfcSound); } } loadSounds(); // // test to play sounds // make sure the start() call comes after the load is complete onInterval = function(){ clearInterval(nbrInterval) for (var i in sounds_array) { trace(tick); sounds_array[i].start(); } }; nbrInterval = setInterval (this, onInterval, 1000); /code hth, Bob Marc Hoffman wrote: Offhand I'm not sure of the problem -- anyone else have an idea? It could be as simple as the use of False rather than false in that last line. But I also wonder about two things: First, I would expect a trace of the mySounds array to return a list of paths to the sounds, not [Object Object]. Second, I'm not sure of the implications of using _root as the scope for every testSound object where you're re-using the name for the Sound object. Since you're calling them in a single action sequence, I don't know if Flash has a chance to start loading one sound before it's replaced by the action to load another sound. At best, loading them sequentially into the same Sound object means you can only access the last sound to be loaded. So you might try assigning a unique name to each sound object. - Marc At 05:49 AM 3/10/2006, murder design wrote: paths are ok, playing them without dynamically loading and placing into arrays is fine. the trace of the array results in: [Object Object] four times, however no play. here is my complete code, no errors, but no results: when i give each sound object the same name, does that matter if there is a pointer within an array element for each one? am i going about this wrong... var mySounds:Array = new Array(); var sPath:String = sound/loops/; mySounds[0] = sPath + Accident-Broadkas-8819.mp3; mySounds[1] = sPath + 5-jakkob-2501.mp3; mySounds[2] = sPath + albert-Mikkel_M-204.mp3; mySounds[3] = sPath + delerium-queali-1634.mp3; var sounds_array:Array = new Array(); var sBaseName:String = sound; // load all sounds in loop function loadSounds() { for (var i:Number = 0; i mySounds.length; i++) { sRef = _root; var testSound:Sound = new Sound(sRef); sounds_array.push(testSound); testSound.loadSound(mySounds[i], False); } } ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com -- Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] The almighty duplicateMovieClip?
You are right. duplicateMovieClip() works within one timeline only. You might try attachMovie() from the Library to get where you want to go. Веб разработчик студии 123.ru wrote: Dear all, There seems to be no answer to this one question on the web, nor did it bother anyone at anytime: The almighty duplicateMovieClip (global funk or MC method, no matter) doesn't seem to be capable of duplicating a MC from one timeline into a different one. The thing I'm trying to achieve is grab a copy of a MC _root.mc1.mc2 (thus it's _name = mc2) into a MC different from _root.mc1, for instance _root But it doesn't seem to be possible. Am I right? Something like this (thought the code is obviously incorrect): _root.mc1.mc2.duplicateMovieClip(_root.newMC, 100); trace(_root.newMC); ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com -- Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] getURL not working
getURL() is the wrong way to go for sending data. The Flash XML object has methods specifically for sending and receiving data. Read up on the XML.load(), XML.send() and XML.sendAndLoad() methods. They'll do you right. hth hidayath q wrote: Hi all, I have doubt in getURL method.Im using a XML in a file which is more than 500 nodes. i will be creating new nodes dynamically in XML and i want to write it to a text file using PHP. im using the getURL method inside press of a button component to transfer the data from flash to PHP.but i cant get.can anyone of pls tell me what wrong in it. Regards, S.Hidayath ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com -- Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com