Re: [Flashcoders] Question regarding use of Delegate in a class
There is another way of doing it as well, FYI, that doesn't use the delegate class. You can take advantage of the fact that handler functions can see local variables and use a local variable to make reference to the class. The line: var parent = this; (or fully typed, var parent:MyClassName = this;) allows you to store a reference to the class instance. You can then reference any method or property by just calling parent.methodName() or parent.propertyName from within your handler functions. private function doFade():Void{ var parent = this; container_mc.onEnterFrame = function(){ this.fader_mc._alpha-=faderSpeed; if(this.fader_mc._alpha = 0){ this.fader_mc._alpha=0; parent.startTimer(); delete this.onEnterFrame; } } container_mc.onRelease = function() { parent.startTimer(); } } Nathan http://www.nathanderksen.com On Feb 21, 2006, at 9:40 AM, Wouter Steidl wrote: private function doFade():Void{ container_mc.onEnterFrame = function(){ this.fader_mc._alpha-=faderSpeed; if(this.fader_mc._alpha = 0){ this.fader_mc._alpha=0; Delegate.create(this, startTimer); -- DOESN'T WORK delete this.onEnterFrame; } } container_mc.onRelease = Delegate.create(this, startTimer); -- ___ 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] hiding datagrid columns?
Use removeColumnAt() and addColumn()/addColumnAt() var dataArray:Array = new Array(); dataArray.push({foo:1, bar:2, baz:3}); dataArray.push({foo:1, bar:2, baz:3}); dataArray.push({foo:1, bar:2, baz:3}); dataArray.push({foo:1, bar:2, baz:3}); dataArray.push({foo:1, bar:2, baz:3}); dataArray.push({foo:1, bar:2, baz:3}); dataArray.push({foo:1, bar:2, baz:3}); dataArray.push({foo:1, bar:2, baz:3}); dataArray.push({foo:1, bar:2, baz:3}); myDG.dataProvider = dataArray; myDG.removeColumnAt(2); // Later call the following to get the column back: myDG.addColumnAt(2, baz); Note that the third column of data is not removed from the data provider when you call removeColumnAt(2), it just removes the visual representation of the data. Nathan http://www.nathanderksen.com On Feb 8, 2006, at 1:47 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Does anyone know a way to hide a datagrid column. The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s)and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender or [EMAIL PROTECTED] ___ 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
Re: Re[4]: [Flashcoders] Q:getter setters vs accessor methods
The line in the constructor: this._size = 2; is calling the setter. Maybe you meant to call this.__size = 2; Setters will trigger regardless of whether the property is set by code within the class itself or from external code. Nathan http://www.nathanderksen.com On Feb 8, 2006, at 5:31 PM, Iv wrote: Hello JesterXL, my test shows anoter result and add new question: -who called getter in the code? class Test { private var __size:Number = 0; function Test() { this._size = 2; } public function get _size():Number { trace(get _size); return this.getSize(); } public function set _size(new_size:Number):Void { trace(set _size); this.setSize(new_size); trace(end set _size\n); } // private function setSize(new_size:Number):Number { trace(setSize); this.__size = new_size; return new_size; } private function getSize():Number { trace(getSize); return this.__size; } } fla: foo = new Test() output: set _size setSize end set _size get _size getSize J size = 2 does: J - setter runs J - getter runs for setter J - getter runs getSize function J - getSize function gets value, returns it J - getter returns value for setter J - setter changes value -- Ivan Dembicki __ __ [EMAIL PROTECTED] || http:// www.design.ru ___ 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
Re: Re[4]: [Flashcoders] Q:getter setters vs accessor methods
Sorry, ignore me, I misread the question. setter != getter Nathan http://www.nathanderksen.com On Feb 8, 2006, at 9:58 PM, Nathan Derksen wrote: The line in the constructor: this._size = 2; is calling the setter. Maybe you meant to call this.__size = 2; Setters will trigger regardless of whether the property is set by code within the class itself or from external code. Nathan http://www.nathanderksen.com On Feb 8, 2006, at 5:31 PM, Iv wrote: Hello JesterXL, my test shows anoter result and add new question: -who called getter in the code? class Test { private var __size:Number = 0; function Test() { this._size = 2; } public function get _size():Number { trace(get _size); return this.getSize(); } public function set _size(new_size:Number):Void { trace(set _size); this.setSize(new_size); trace(end set _size\n); } // private function setSize(new_size:Number):Number { trace(setSize); this.__size = new_size; return new_size; } private function getSize():Number { trace(getSize); return this.__size; } } fla: foo = new Test() output: set _size setSize end set _size get _size getSize J size = 2 does: J - setter runs J - getter runs for setter J - getter runs getSize function J - getSize function gets value, returns it J - getter returns value for setter J - setter changes value -- Ivan Dembicki _ ___ [EMAIL PROTECTED] || http:// www.design.ru ___ 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
Re: [Flashcoders] dynamic text field whoas
Damn, I always thought that seemed a silly way to do it. After all this time of re-calling that bloody thing every time I changed it. Thanks for the correction, I'll go back and fix my old code :-) Nathan http://www.nathanderksen.com On Feb 7, 2006, at 2:49 PM, Ian Thomas wrote: Or call setNewTextFormat() instead. setTextFormat() applies to the _existing_ text within the field. setNewTextFormat() applies to any text that will be put into the field. This is why (Nathan) you're having to call setTextFormat() multiple times - calling setNewTextFormat() just once, before putting anything into the field, should solve that issue. HTH, Ian On 2/7/06, Nathan Derksen [EMAIL PROTECTED] wrote: You need to re-apply setTextFormat() every time you change the .text or .htmlText properties of a text field: snip percent.text = percentNum; percent.setTextFormat(ldrFormat); snip I tried this out with your code, and it worked fine afterwards. ___ 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
Re: [Flashcoders] How do you code your Flash applications?
You make it sound like I'm forcing it to work. I'm not forcing it, it works as a nice byproduct of how I normally setup and group my movie clips. I see this as being good coding practice. Things that are grouped together share a parent movie clip, making control of the group easier and making depth management easer as each movie clip manages the depths of its children. I hate renumbering depths, and I don't like having to figure out blocks of depths then later finding that I need to move a block later on. This works very cleanly for me, both from architecting movie clips into a logical hierarchy and from preventing annoying depth collisions. I don't deny that it will not work in all situations, nor did I claim so, nor do I know your particular experiences with depth management. I do however have a hard time imagining that manual depth management is a best practice. Anyway, this has gone on long enough. If you haven't gotten the point yet you're never going to. Nonsense, this is a great debate IMHO, and I would love to hear more from others as well. This is something that everyone has to deal with, and I genuinely thought that others would make more use of getNextHighestDepth() and was surprised that you and others avoid it. What are the situations that you have come across where only manual depth management would work? Do you have other ways of managing depth? Nathan http://www.nathanderksen.com On Feb 6, 2006, at 3:10 PM, ryanm wrote: Then I create a placeholder movie clip... You miss the point. Doing something because you can usually find a way to make it work doesn't make it a valid replacement for good coding practices. That you rarely come across a scenario that you can't handle that way only means that there *are* scenarios that won't work that way, and that it is likely that at least some of the time when it does work for you it would still be better (more efficient, more readable, etc) to do it a different way. Also, just because you rarely run into situations that don't work that way doesn't mean that others don't run into them all the time, which means your method probably isn't the best one to be recommending broadly in a thread about best practices. Why not pick a good, standardized way to manage depths that works in every scenario? Anyway, this has gone on long enough. If you haven't gotten the point yet you're never going to. ryanm ___ 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
Re: [Flashcoders] How do you code your Flash applications?
Then I create a placeholder movie clip in the order I intend for it to go, then put the new movie clips in that clip later. The parent clip holds the depth, so no matter how many child clips I create, they are always ordered relative to the rest of the content as intended. I always group related content into its own movie clip to simplify moving/animating/hiding the content anyways. I rarely come across scenarios where a combination of movie clip organization and getNextHighestElement do not work as intended. Nathan http://www.nathanderksen.com On Feb 5, 2006, at 1:33 AM, ryanm wrote: and you want to add something between the content and the footer, then just add it in between: buildHeader(); buildContent(); buildMoreContent(); buildFooter(); Guess where the new stuff ends up? No figuring out what depth to assign, no re-assigning depths, no collisions. Nice and simple. What if it's not supposed to be built at the same time as the other elements? There are thousands of what ifs that might make your example not work. All of this becomes moot with the AS3 DisplayList, but as long as you have to work with the current depth system, it is a good idea to keep track of where you are putting stuff, rather than depending on execution order to place them in the right depths. ryanm ___ 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
Re: [Flashcoders] using MCL to keep track of total bytes loaded.
No, you will have problems with that implementation. You can't just add loadedBytes to your total. Say you are loading just one movie clip, you start off with zero, then 10 bytes come in, so loadedWeight is now 10. Next, 10 more come in so loadedBytes reports 20, which is added to your total, leaving loadedWeight at 30, which is incorrect. Instead, you can have a function that loops through each movie clip to test for loadedBytes. mainMclListener.onLoadProgress = function( targetMC, loadedBytes, totalBytes) { var totalBytes:Number = 0; var numClips:Number = mainSWFArray.length; for (var i:Number = 0; i numClips; i++) { totalBytes += baseTimeline [mainSWFArray.id].getBytesLoaded(); } // then do a test to find out the percentage loadedWeight is of totalWeight. i need to know when it's reached 10%, 20%, 30%, etc... } The baseTimeline reference should be replaced with a reference pointing to the parent movie clip. This is a bit inefficient, though. If you want, I can show you a more efficient way of doing it using a single setInterval() call. Nathan http://www.nathanderksen.com On Feb 4, 2006, at 9:26 AM, Matt Ganz wrote: hi. i have a question on using the MovieClipLoader class to load an array of swf files. i just want to add the loadedBytes of each swf to another variable so i can constantly compare the loaded to the total of all swf files. in the end, i need to figure out the percentage of the total swfs combined weight is loaded. i've started off a little here but am not sure how to compare the values or if i'm adding it correctly. can anyone see if i'm approaching this correctly so far? here's my code: // An array that holds the paths to external swf files. var mainSwfArray:Array = new Array( { path: one.swf, id: one_mc, depth: 6 }, { path: two.swf, id: two_mc, depth: 8 }, { path: three.swf, id: three_mc, depth: 18 }, { path: four.swf, id: four_mc, depth: 16 }, { path: five.swf, id: five_mc, depth: 14 }, { path: six.swf, id: six_mc, depth: 12 }, { path: seven.swf, id: seven_mc, depth: 10 } ); var totalWeight:Number = 5677376; // the total weight of the swf files in the mainSwfArray (in bytes). var loadedWeight:Number = 0; // we'll add to this variable as the movies get loaded. var mainMCL = new MovieClipLoader(); var mainMclListener = new Object(); mainMCL.addListener( mainMclListener ); // onLoadProgress() mainMclListener.onLoadProgress = function( targetMC, loadedBytes, totalBytes) { loadedWeight += loadedBytes; // then do a test to find out the percentage loadedWeight is of totalWeight. i need to know when it's reached 10%, 20%, 30%, etc... } thanks. -- matt. ___ 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
Re: [Flashcoders] How do you code your Flash applications?
getNextHighestDepth() is your friend :-) Nathan http://www.nathanderksen.com On Feb 3, 2006, at 2:05 AM, ryanm wrote: Another little bit of advice you may find useful, don't put depths right next to each other, leave room between them. When developing a UI, I often put them 10 depths apart, as in navigation container at 10, content container at 20, footer container at 30, etc, instead of at 1, 2, and 3. That way, if I need to add a new section, or if I need to drop in additional elements like a scrollbar, etc, I have a depth available without having to go through the code and increment all the subsequent depths. Since there are 65k depths available and I rarely use more than a dozen on any given timeline, I figure spacing them out is safer than putting them right next to each other. ryanm ___ 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
Re: [Flashcoders] LoadClip and centering new content
Ah yes, that's a fun issue. Unfortunately, once you load an SWF inside another, there is no way that I know of to get the original published stage size. I would love to be proved wrong, though, but I have looked hard for a way to do that as well. All you can really do is keep xscale and yscale to 100, and use a fixed size mask so that anything outside of the area you have set aside for the clip is hidden (in case stuff goes outside the bounds of the stage). Nathan http://www.nathanderksen.com On Feb 3, 2006, at 8:06 AM, Éric Thibault wrote: I already do that... but the width and height of the container clip takes into account any instances outside the boundary of the loaded SWF's stage... So I'm getting the total with and height but want only the stage dimentions of the loaded SWF! I want to align the loaded SWF'stage in the loading flash If it was just for me, i would not put anything outside the stage of the loaded SWF but I'm not the producer of those swf... And having the stage dimentions would help because the loaded SWF's dimentions only takes into account the instances present on frame 1... (mc_square 100*100 at (0,0) on a stage of 300*300 results in a container clip of 100*100!) A+ j.c.wichman wrote: Hi, If you use something like: var my_mcl:MovieClipLoader = new MovieClipLoader(); var myListener:Object = new Object(); myListener.onLoadInit = function(target_mc:MovieClip) { trace(target_mc._width); }; my_mcl.addListener(myListener); my_mcl.loadClip(YOUR path to SWF here eg test.swf, path to container here_root.dummy); It should trace the width of your clip upon load. Is that what you mean? Greetz Hans -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Éric Thibault Sent: Friday, February 03, 2006 3:11 PM To: Flashcoders Mailing List Subject: RE:[Flashcoders] LoadClip and centering new content Hello again... My problem is : how to know the stage's dimentions of a loaded SWF to center it correctly in its container? Here's my tests on that particular problem 1. Set _lockroot inside the loaded SWF : no effect. 2. Set Stage.scaleMode = |noScale : no effect. |When I execute the loaded SWF independently, the Stage dimentions are OK but once loaded inside another Flash movie, the Stage's dimentions are those of the main movie. I was looking to include a mc with the same dimentions as the stage inside the loaded SWF but there will be a lot of SWF and not all made by me! I there a way to retreive this kind of information or is it impossible? Thanks a million. ___ 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
Re: [Flashcoders] How do you code your Flash applications?
No, but what Ryan describes is exactly what getNextHighestDepth() is for. Nathan http://www.nathanderksen.com On Feb 3, 2006, at 8:19 AM, Scott Hyndman wrote: It's not when you don't want the movieclip to be on the highest depth. Scott -Original Message- From: [EMAIL PROTECTED] on behalf of Nathan Derksen Sent: Fri 2/3/2006 11:07 AM To: Flashcoders mailing list Cc: Subject:Re: [Flashcoders] How do you code your Flash applications? getNextHighestDepth() is your friend :-) Nathan http://www.nathanderksen.com On Feb 3, 2006, at 2:05 AM, ryanm wrote: Another little bit of advice you may find useful, don't put depths right next to each other, leave room between them. When developing a UI, I often put them 10 depths apart, as in navigation container at 10, content container at 20, footer container at 30, etc, instead of at 1, 2, and 3. That way, if I need to add a new section, or if I need to drop in additional elements like a scrollbar, etc, I have a depth available without having to go through the code and increment all the subsequent depths. Since there are 65k depths available and I rarely use more than a dozen on any given timeline, I figure spacing them out is safer than putting them right next to each other. ryanm ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] How do you code your Flash applications?
I always have a movie clip as a base. Gives a better platform for moving everything around together if I need, and getNextHighestDepth () works as advertised. Nathan http://www.nathanderksen.com On Feb 3, 2006, at 8:23 AM, Bart Wttewaall wrote: And certainly not when you work within the _root. It will give depths at which you can't remove movieclips. 2006/2/3, Scott Hyndman [EMAIL PROTECTED]: It's not when you don't want the movieclip to be on the highest depth. Scott -Original Message- From: [EMAIL PROTECTED] on behalf of Nathan Derksen Sent: Fri 2/3/2006 11:07 AM To: Flashcoders mailing list Cc: Subject:Re: [Flashcoders] How do you code your Flash applications? getNextHighestDepth() is your friend :-) Nathan http://www.nathanderksen.com On Feb 3, 2006, at 2:05 AM, ryanm wrote: Another little bit of advice you may find useful, don't put depths right next to each other, leave room between them. When developing a UI, I often put them 10 depths apart, as in navigation container at 10, content container at 20, footer container at 30, etc, instead of at 1, 2, and 3. That way, if I need to add a new section, or if I need to drop in additional elements like a scrollbar, etc, I have a depth available without having to go through the code and increment all the subsequent depths. Since there are 65k depths available and I rarely use more than a dozen on any given timeline, I figure spacing them out is safer than putting them right next to each other. ryanm ___ 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] LoadClip and centering new content
Not that I know of. If the first frame was representative of the size as a whole, then iterating through the movie clips looking for clips with negative x/y values could be done, however it's sort of a moot point as soon as everything moves around in subsequent frames. I also don't think that will work if some of the symbols are graphic symbols instead of movie clips. You basically need to know in advance what the size of the clip is going to be, then code that into your positioning code. Not pretty, but it's doable. Nathan http://www.nathanderksen.com On Feb 3, 2006, at 8:40 AM, Éric Thibault wrote: Mmm... The funiest thing is that if I want to center my loaded SWF that has instances outside the loaded SWF'stage, it gets shifted :'( Is there a way to know the nomber of pixels to the left, top, bottom and right of the registration point (0,0) of a container? I could than compensate for the extras of the SWF inside of it... Say that my container is 200px in width but I know that it has 50px extra to the left (-50px), my real width is then 150px?? A+ ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] How do you code your Flash applications?
Free is always nice to have :-) That's pretty wicked support, though. I considered it, but I like to support SEPY partially because they are at least working on a Mac version, while PrimalScript is not that I know of. Nathan http://www.nathanderksen.com On Feb 3, 2006, at 8:41 AM, Andreas Rønning wrote: Surprised at the lack of support for Primalscript on this list :) It's easily the most comprehensive and solid scripting IDE out there, and for mid to large scale flash development i don't see how i could do without it. In particular the dynamic code completion and code hinting for your own methods as you write them is really really nice to have. Another thing that's nice about something NOT being open source and NOT being modified by every geek on the block is that you have actual customer support heh. Like when i first tried out Primalscript 3 and found that it handled alt gr keys in such a way as to make scripting near-impossible on norwegian keyboards (alt gr+7 through alt gr+0 for brackets and curly braces, and the alt gr key was invariably setting keyboard focus to the menu bar). I notified them, immediatly got a message back that they had ordered a norwegian keyboard and was going to fix it asap. Was fixed within the week. Raw. Never caught on to se|py unfortunately, mostly because i change the colors on my code highlighting to run on a black background (black with light grey letters is easier on my eyes in the long run. Less staring at the sun), and se|py has line highlighting that's black, making the current line invisible ;P Couldn't work with that. Funny how simple i am. - Andreas Nathan Derksen wrote: Yah, I really like it too, but it does the same thing for me. I save constantly anyways, so I rarely lose anything. I have yet to get the Mac version to actually run, which is a shame. Nathan http://www.nathanderksen.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Driven Application Driving me crazy :)
This is a problem that has been addressed numerous times. I suggest that you search the archives at http://chattyfig.figleaf.com/ pipermail/flashcoders/ The summary is that the speed problem usually has little to do with the actual xml handling and more to do with how you are updating the user interface, especially if you are using components. Parse all of the XML data first, placing the data of interest into an array of objects. Only once you have built the array should you set your component's data provider or otherwise update the user interface. Nathan http://www.nathanderksen.com On Jan 31, 2006, at 9:33 AM, Ing. Mario Falomir wrote: Hi, I need some advice from you guys :) I have an XML Driven FLash APP, basically it's a tool that displays charts and data in grids, containers, etc...that my client will handout in CDs. So at the beginning of the development process I thought XML would suit perfectly in the purpose of this app. But it happened that the DB used to generate the apporpiate XML files that my app consume had grown amazingly so eventually my app (exclusively the part that searches for an specific registry entry) turns very slow and sometimes (rarely but happens) it crashes due to the exhaustive loops and interations i do in order to the search/ display data of an specific registry and filtering functions. So i thouhgt, upon your experience, to ask how would you do to optimize this thing or what its the best way to do the queries to an XML in order smooth things a little bit more :) Or what approaches (or guidelines ) do you use when you have to develop an app. that will have XML to serve as its DB. Do you load everysingle XML at once ? on demand ? etc ? Thanks in advanced! Mario ___ 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
Re: [Flashcoders] Tell me more about _global
Yah, as Ian mentioned, you lose all type checking with this technique. Also, you require that the object be in the global name space, while a singleton class does not clutter up the global namespace at all (var globalData = AppState.getInstance(); globalData.foo = bar). Finally, how do you alert other parts of the application to a change in a property? Setters and getters can do that for you automatically by broadcasting an event, but an anonymous object can't do that, you have to trigger the event yourself when you change the property. Not understanding why something is done in a particular way does not make it lame. Nathan http://www.nathanderksen.com On Jan 31, 2006, at 3:08 PM, Steven Sacks wrote: Making a class for globals is lame. I don't get why people do stuff like that. It's completely unnecessary. Here's how I make a namespace for globals in one line. On frame one of the root timeline: _global.APP = {}; Wow. That was so hard. APP.someglobal APP.someotherglobal APP.etc Nathan Derksen nderksen at sfu.ca wrote: I generally keep at least one singleton class which is responsible for storing global properties. I make those properties accessible with getters and setters so that I can allow changes in those properties to trigger events. You can't really do that if you use _global to store your data. Also, there is always a risk in name space collision if you load in other elements that also use global, where one or more variables use the same name and are thus inadvertently shared for different uses. You definitely do not want to use _global within any classes that you create, as that can cause entanglement, gives you no private protection, and does not properly contain your code into a well-defined unit with a well-defined API. Nathan http://www.nathanderksen.com ___ 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
Re: [Flashcoders] XML Driven Application Driving me crazy :)
Yah, agreed. I just know from experience on the various boards that one of the most common mistakes for people to make is to update a combo-box or data grid for each iteration of the xml parsing loop rather than waiting until the end. That can lock up the player tight, while if you wait till the end to set the data provider, even a quite sizable xml file generally won't cause the dreaded this app is running slowly alert. Nathan http://www.nathanderksen.com On Feb 1, 2006, at 8:28 AM, Merrill, Jason wrote: The summary is that the speed problem usually has little to do with the actual xml handling and more to do with how you are updating the user interface, I'm sorry, but I partially disagree with that statement based on my experience. Components can take some time to render, sure, but for me, most of my XML data loading time woes stem from the time it takes the player to load a large XML file. If I am using something to parse into objects, that takes even more time. Once the data is loaded into a variable/object/property in Flash, the time it takes to updating a component is far less of a concern - usually its lickity split. If you're not using components, its even faster. Jason Merrill | E-Learning Solutions | icfconsulting.com NOTICE: This message is for the designated recipient only and may contain privileged or confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of this e-mail by you is prohibited. ___ 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
Re: [Flashcoders] XML Driven Application Driving me crazy :)
To answer your question a bit more, there are a couple of approaches. One approach is to build in the filtering server-side, so that when you need a subset of the data for something, you send a request to the server, which does the filtering and only sends what is relevant as XML. This is useful if you rarely need to actually work with small subsets of data, not the full list. If that's not the case, then as I mentioned previously, load all the data, parsing it into an intermediate data set. You can then do fairly quick searches through that data and build a smaller data set to feed to your components. Alternately, there are XML XPath implementations out there that are designed to be able to search through XML data quickly. I personally prefer the build-your-own array of objects approach, though, as it gives me full control over how I work with the data, however others really like using XPath. Use whatever works for you :-) Nathan http://www.nathanderksen.com On Jan 31, 2006, at 9:33 AM, Ing. Mario Falomir wrote: Hi, I need some advice from you guys :) I have an XML Driven FLash APP, basically it's a tool that displays charts and data in grids, containers, etc...that my client will handout in CDs. So at the beginning of the development process I thought XML would suit perfectly in the purpose of this app. But it happened that the DB used to generate the apporpiate XML files that my app consume had grown amazingly so eventually my app (exclusively the part that searches for an specific registry entry) turns very slow and sometimes (rarely but happens) it crashes due to the exhaustive loops and interations i do in order to the search/ display data of an specific registry and filtering functions. So i thouhgt, upon your experience, to ask how would you do to optimize this thing or what its the best way to do the queries to an XML in order smooth things a little bit more :) Or what approaches (or guidelines ) do you use when you have to develop an app. that will have XML to serve as its DB. Do you load everysingle XML at once ? on demand ? etc ? Thanks in advanced! Mario ___ 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
Re: [Flashcoders] Tell me more about _global
Coolness, I missed that before. The actual page that this is shown is http://livedocs.macromedia.com/labs/1/flex/langref/migration.html for those who don't want to search through the docs. Nathan http://www.nathanderksen.com On Feb 1, 2006, at 6:29 PM, David Peek wrote: Besides, you don't want to go teaching people bad habits, especially when the _global scope is not long for this world... AS2: _global AS3: Removed. Comment: Use a static member of a class instead. from http://livedocs.macromedia.com/labs/1/flex/langref/index.html David You are clearly an idiot. Scott -Original Message- From: [EMAIL PROTECTED] on behalf of Steven Sacks Sent: Wed 2/1/2006 2:43 PM To: 'Flashcoders mailing list' Cc: Subject:RE: [Flashcoders] Tell me more about _global Let's make classes for everything. Let's make components out of everything. There are so many benefits to complicating things and we CAN do it so we SHOULD do it because it's so clever and smart to do it that way. Let's code everything in one frame when working closely with designers so we can make them feel stupid and helpless when they go into our application and can't find anything and we can feel so superior to them because it's so obvious and now we have to walk them through it and by doing so can show them how smart and clever we are. Let's stroke our egos to prove what smart coders we are and program job security into our applications by making it extremely difficult for our clients to hire anyone else to work on our code, especially considering we might not be available (busy, vacation, dead) to help walk anyone through the complicated messaging system we've put into place to do something as simple as storing global variables. It's such a clever way of doing things, don't you see? We've built a better mousetrap! Those people using a simple global namespace objects are suckers! I'm not saying variable watchers and events don't have their place, but we're talking about a global namespace to store variables available to the entire application, a replacement for _global and the conflicts that can arise from it, something that has been done longer than you've been coding. You're acting like a simple global namespace to store variables is only for noob coders and that really smart coders make their code super complicated. You guys are the reason Dreamweaver MX 2004, Photoshop 7, etc. take 10-20 seconds to start up instead of 1-3 like their predecessors. You guys are the reason many clients have bad tastes in their mouths from working with independent contractors. Why not apply your cleverness and creativity to planning your next DD campaign or go learn a real programming language like C and learn to program games if you're so smart. As far as debugging goes, I've never had trouble with standard debugging techniques. You know, like trace() and NetDebug.trace(). Quick and easy. Here's my debug code: import mx.remoting.debug.NetDebug; NetDebug.initialize(); _global.out = function(m) { trace(m); NetDebug.trace(m); } Oh noes! It's not complicated enough for you! Feel superior in your complicated debugging style! ;) ___ 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
Re: [Flashcoders] What native events do (AS2, but not V2) components implement?
Take a look in the Flash help panel under Components Language Reference - UIComponent Class and UIObject Class. Most components inherit from UIComponent, which in turn inherits from UIObject, so all the properties/methods/events listed for these two classes will apply. When you create your own components, you have a choice as to whether you want to go the somewhat lighter-weight approach and just extend UIObject, or to get the full V2 framework from UIComponent. Nathan http://www.nathanderksen.com On Jan 31, 2006, at 4:22 AM, Alias wrote: Hi guys, This is always really hard to find information about, so I wanted to ask the list. Which events do AS2 components automatically have? I'm not talking about V2 components, I'm referring to components created from scratch in AS2. For example, there are functions like onResize, which seem to be automatically called, and others, which don't, but get implemented by the component developers themselves. Can anyone point me to a list of these? Or just let me know what they are? Cheers, Alias ___ 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
Re: [Flashcoders] Tell me more about _global
I generally keep at least one singleton class which is responsible for storing global properties. I make those properties accessible with getters and setters so that I can allow changes in those properties to trigger events. You can't really do that if you use _global to store your data. Also, there is always a risk in name space collision if you load in other elements that also use global, where one or more variables use the same name and are thus inadvertently shared for different uses. You definitely do not want to use _global within any classes that you create, as that can cause entanglement, gives you no private protection, and does not properly contain your code into a well-defined unit with a well-defined API. Nathan http://www.nathanderksen.com On Jan 31, 2006, at 6:26 AM, Manuel Saint-Victor wrote: I'm reading about the wrongs of using _global in various books and articles and blogs but I have used several extensions and resources that I am confident are well built that seem to be making use of _global. My current project has some use of _global in the code that I am updating an I m wondering in which cases I should try to remove those. Is there a reference that I can read that would educate me on the reasons not to use _global and even tell me some workarounds that would allow me to safely use _Global if it's necessary. I'm familiar with the use of the Singleton pattern but feel as if in some cases I might be better with some _globals. One case in particular that I'm considering is for some functions that we would like to have globally available. Am I better off making them static functions of a class (like Math.random() etc) and having people importing the class or just plopping them as functions on the global timeline? Thanks in advance- Mani ___ 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
Re: [Flashcoders] avoiding a stack of lists
Well, regardless of whether or not you use listeners, you still need to create the data relationship. I don't think encoding the relationships into 25 listeners is necessarily a good idea, either. An associative array, indexed by ID, could store the IDs of the other list items that are related, all in a single data structure. So for instance: listRelationships[itemID1] = [itemID2, itemID3]; listRelationships[itemID2] = [itemID1]; listRelationships[itemID3] = [itemID2]; This allows you to store arbitrary relationships between each list item. When a list item is moused over, just grab listRelationships [itemID] and you will get a corresponding array of list items to highlight. Nathan http://www.nathanderksen.com On Jan 30, 2006, at 8:30 AM, Alan MacDougall wrote: Kent Humphrey wrote: I've made a single item work with my initial solution, which was to have a list for each item that lists which items in the other lists should highlight. But by the time I've made 25 lists for my 25 (current) items, that seems like a lot of redundant and duplicated data somehow. That sounds to me like you want to use events -- the items which light up should listen to the items that trigger them. When the triggering item gets moused over, the listening item(s) can decide whether to react. This might just take your redundancy and put it somewhere else, but it keeps you from writing and checking a ton of different lists. ___ 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
Re: [Flashcoders] avoiding a stack of lists
Sorry for the delayed response, it's been a busy day. It's been a while since I have touched Lingo, so I won't comment there, but yah it's basically a list of properties. Associative arrays can be accessed in two ways. First: listRelationships:Object = new Object(); listRelationships[propertyName] = foo; trace(listRelationships[propertyName]); and second: listRelationships:Object = new Object(); listRelationships.propertyName = foo; trace(listRelationships.propertyName); The two syntaxes are equivalent and interchangeable. I used the first syntax because it easily allows you to access properties by name, passed through another variable. var itemID:String = itemID1; trace(listRelationships[itemID]); You would create your full data structure, each line representing one list item and containing an array of IDs linked to the given ID. Ideally you would pull this data in from an external source, such as through XML or through LoadVars, and build this data structure dynamically. Also, this is only one way of doing it. Another way may be more appropriate for you, given your particular requirements. var listRelationships:Object = new Object(); listRelationships[itemID1] = [itemID2, itemID3]; listRelationships[itemID2] = [itemID1]; listRelationships[itemID3] = [itemID1, itemID3]; ... listRelationships[itemIDN] = [itemID6, itemID7, itemID8]; When one of the items is selected or moused over, you call a function that you create, pass in the ID of the item in question, and use that ID to find the related IDs: function handleSelect(itemID:String):Void { var selectedItemData:Array = listRelationships[itemID]; for (var i:Number = 0; i selectedItemData.length; i++) { // Get each row that should also be highlighted trace(selectedItemData[i]); } } I hope this helps. Nathan http://www.nathanderksen.com On Jan 30, 2006, at 9:26 AM, Kent Humphrey wrote: On 30 Jan 2006, at 17:13, Nathan Derksen wrote: Well, regardless of whether or not you use listeners, you still need to create the data relationship. I don't think encoding the relationships into 25 listeners is necessarily a good idea, either. An associative array, indexed by ID, could store the IDs of the other list items that are related, all in a single data structure. So for instance: listRelationships[itemID1] = [itemID2, itemID3]; listRelationships[itemID2] = [itemID1]; listRelationships[itemID3] = [itemID2]; This allows you to store arbitrary relationships between each list item. When a list item is moused over, just grab listRelationships [itemID] and you will get a corresponding array of list items to highlight. Nathan http://www.nathanderksen.com That sounds a bit more like where I'm at. Not that I've used associative arrays before, but they're basically the same as property lists in Lingo right? In your above example, wont I still need a listRelationships [itemID1] = [whatever] line for each item I'm wanting to reference? Or have I totally misunderstood what's going on there? ___ 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
Re: [Flashcoders] Problems with Flash Plugin Switcher 2.1.0
Yup, works great. I wish there was a version for the Mac as well. Nathan http://www.nathanderksen.com On Jan 22, 2006, at 4:35 PM, Johannes Nel wrote: not an insatller just an executable and it works like a charm. On 1/22/06, Adrian Lynch [EMAIL PROTECTED] wrote: I'm just about to install Flash Plugin Switcher 2.1.0 and wondered if this has caused any problems for anyone. I'm coming to the end of a project and I don't fancy trying to fix player issues when I should be working :O) Oh and does it work as nicely as it sounds? Thanks. Adrian ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- j:pn ___ 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
Re: [Flashcoders] Final Class Question
A few points: First, you are not actually setting the amMessage and pmMessage properties anywhere. The variables that you are passing through the constructor actually obscure those two properties because they share the same variable name; they don't copy any data. Second, it's a better idea to make the properties private, and use getters and setters as is shown below. You still access the properties in the same way (classInstance.amMessage = foo), but it makes a function call instead. That way, if you need to do something else in response to the changed property, you can easily add it without affecting the API. Third, it's good to name private properties using a naming convention that allows you to easily identify in your code the fact that it is a class property. I prepend a p to the variable name, others like prepending a _ character. Do whatever you want, just use it consistently. class com.bushidodeep.TimeStamp { private var now:Date; private var pAMMessage:String; private var pPMMessage:String; // Movie clip that will contain visual // elements of the hello. private var container_mc:MovieClip; // // public function TimeStamp(target:MovieClip, x:Number, y:Number, amMessage:String, pmMessage:String) { init(target, x, y, amMessage, pmMessage); } private function init(target:MovieClip, x:Number, y:Number, amMessage:String, pmMessage:String):Void { now = new Date(); pAMMessage = amMessage; pPMMessage = pmMessage; container_mc = target.createEmptyMovieClip(blah, 1); container_mc._x = x; container_mc._y = y; container_mc.createTextField(messageText, 0, 0, 0, 400, 25); container_mc.messageText.setNewTextFormat(createFormat()); container_mc.messageText.text = createGreeting(); } private function createGreeting():String { var greets:String = now.getHours()12 ? pAMMessage : pPMMessage; var fullGreeting:String = The time is now +formatTime(now)+greets; return fullGreeting; } private function createFormat():TextFormat { var messageFormat:TextFormat = new TextFormat(); messageFormat.font = Verdana; messageFormat.color = 0xff; messageFormat.bold = true; return messageFormat; } private function formatTime(theDate:Date):String { var hour:Number = theDate.getHours(); var minute:String = theDate.getMinutes()9 ? theDate.getMinutes ().toString() : 0+theDate.getMinutes(); var timeString:String = hour12 ? (hour-12)+:+minute+PM. : hour +:+minute+AM.; return timeString; } public function set amMessage(message:String):Void { pAMMessage = message; } public function get amMessage():String { return pAMMessage; } public function set pmMessage(message:String):Void { pPMMessage = message; } public function get pmMessage():String { return pPMMessage; } } Nathan http://www.nathanderksen.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how does ExternalInterface behave in Flash 7 and earlier
ExternalInterface requires Flash 8, it won't compile back to v7. You can use the integration kit just fine. There is a distinction between extending an open source project and using it as a library. In this case, you are using it unmodified as a library, which does not require you to make your whole project open source. You are thinking of the GPL, while when using an open source project as a library would be covered instead under the LGPL, the lesser GPL. In the case of this kit, the license is much more lenient than either the GPL or the LGPL. The license for the integration kit can be seen at http://weblogs.macromedia.com/flashjavascript/license.txt Nathan http://www.nathanderksen.com On Jan 19, 2006, at 6:40 AM, Manuel Saint-Victor wrote: I've been Googling for a statement about this that I am comfortable with. I am wondering if the externalInterface is an IDE thing or player specific thing. If a user has Flash Player 7 installed does that mean no use of the externalInterface and if so how are people dealing with this? Are you guys waiting for a greater penetration of the Flash8 player? The current project is not open source and I believe that means that I can't use the Flash-Javascript integration kit. Thanks, Mani ___ 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
Re: [FlashCoders] FSCommand Problems with Mac
Yup, fscommand is not supported on many/most Mac browsers: http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_14159 Depending on what you want to do, the alternatives are to use getURL (javascript:foo()); to call a javascript function (no return data allowed), to use the Flash 8 ExternalInterface class, or to use the Flash-JavaScript integration kit (http://weblogs.macromedia.com/ flashjavascript/). Nathan http://www.nathanderksen.com On Jan 20, 2006, at 1:01 PM, Ben Wakeman wrote: Anyone have good experience with FSCommands? We are trying to do some very basic stuff and finding radically inconsistent support across browsers that are supposed to work at least according to Colin Moock: http://www.moock.org/webdesign/flash/fscommand/#methods We are unable to get FSCommands to work at all on the Mac platform. Safari, FireFox = no love. I thought the problem may be a result of us putting the little VBScript call and the JS function in the BODY rather than the HEAD. So, I put the scripts in the HEAD, still no love, but we got the added bonus of PC Internet Explorer not longer working! Any council would be greatly appreciated! Thanks. -Ben ___ 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
Re: [Flashcoders] my old problem... with big loads of swf's
Have you tried loading them into movie clips instead of levels? I generally try staying away from levels when at all possible. Also, you can use the movie clip loader class to make the movie clip loads sequential, loading the next movie after the previous movie generates an onLoadInit event. Third, you can use setInterval to delay the initial load a little bit so that it is not loading during the initial startup of the projector exe. Nathan http://www.nathanderksen.com On Jan 18, 2006, at 5:47 AM, julian atienza wrote: At least somebody helps me... I posted my problem here several times, about swf's and big loads in projector but no solutions. Some helpful and patient words, but i was beleaving i was going crazy (everybody tolds me here that it wasn't a normal success) I posted my question in Creative Cow: Hello. I posted my problem several times in several forums (but this is my first post here) I haven't found a solution and the time for my project is running so fast (i'm working hard, mornings, evening, nights, but no solutions for this problem) The Scene: i'm programming a Projector-Flash Project that loads contents in local. It uses _levels, AS2, and a MovieClipLoader to load contents in each _level through navigation in the app. There is some big swf (5Mb) to load, but size must not be a problem in a local-project (Kiosk CD or DVD project) The Problem: when i Load the swf's in the appropiate _level, the previous _level goes frozen (even a simple animation of time to wait during load). I also tried a preloader technique in the swf that is being loaded with two scenes, but the animation of the first scene also is frozen until the complete load is made. The Cause: I think the cause of the problem has the following reason... When i load in remote (flash web projects), there is a portion of memo/processor free. So i can make anything during this time. When i load in local, all the resources are taken to make the load, so anything is frozen till the load is complete. DESPERATE: I've tried all kind of methods (Preloaders, MovieClipLoader (It only gives me 0% and 100% in events to control load), and so on... no solutions. Can anybody solve this problem? Thank u in advance --- In Creative Cow one person post me the following: -- My experience with the projector is it doesn't do a progressive download like SWFs do on the internet. I've never used the projector to dynamically load SWFs, but I've made projectors of very large SWFs (20-75MB) and it seems to me that when you run them, they need to load the full file into memory before the projector app starts running (except for FLVs, which still seem to stream fine). It wouldn't surprise me if it were the same for the dynamically loading assets, which would only be an issue when you have large files. The fact that it freezes things that are already loaded and running is somewhat surprising to me, but not entirely unexpected. I'm still with the same problem. But i hope that it helps to people to NEVER try to build a big application developed in flash and actionscript (even Flash 8) without considering that advertisement... thanks to all people... ___ 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
Re: [Flashcoders] embed SWF with PHP
A DOM viewer, such as the one that comes with Firefox, can easily allow you to get the URL of anything on the page, dynamic or not. To my knowledge, there is no way of hiding from that. You can then put that URL directly in the address bar, and retrieve the SWF file with save as... Nathan http://www.nathanderksen.com On Jan 17, 2006, at 6:43 AM, Mike Britton wrote: Pumping the object and embed tags into a DIV's innerHTML using AJAX is one possibility. You could also write the object and embed tags with an external JavaScript. This would prevent the source from being viewed and is probably an easier option given its all on the client. It's impossible to completely hide your swf filename, and techniques for preventing caching are dodgy at best. If anyone knows how to make swfs un-obfuscatable I'd like to hear their approaches. hth Mike ___ 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
Re: [Flashcoders] reducing build times
In the Flash IDE, you can convert movie clips in the library into compiled clips. Select your movie clips, right click, and select Convert to Compiled Clip. This will pre-compile these movie clips, and their linkage IDs (if any) will also remain intact. I've done this in the past with movie clips for custom skins, and it saved a heap load of time from the compile process. I had one movie clip as a placeholder that contained a copy of all the other movie clips. Compiling the one movie clip automatically included all the other ones in the compiled clip. The one thing is that make sure you save your original movie clips in another file, as once you convert then delete the original clip, the compiled clip is not editable. Nathan http://www.nathanderksen.com On Jan 8, 2006, at 4:49 PM, Mark Winterhalder wrote: On 1/9/06, Uri [EMAIL PROTECTED] wrote: i'm trying to reduce build (publish) times for a project i'm working on. I have many vector symbols that have AS2 classes assigned to them. Since i'm working with complex vector symbols, it takes flash quite a while to publish the swf of the movie each time. Could anyone suggest a way to have the symbols' graphic vector data compiled once, so that i can later change their AS2 class code without compiling the vector data for them over and over again? thanks Uri ___ 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
Re: [Flashcoders] Singleton as associative array - yucky icky?
I would say to hell with the VB coders (and I used to be one). What if you want to change your implementation later on? What if this functionality changes with AS3? Without an API, you open yourself up to all sorts of fun stuff that may force the user to have to change their code later on. Be nice to yourself and to your users. You'll be happier in the end, and your guilt will be assuaged (rightly so)! And when was the last time that VB/VBScript catered to anyone in the Java, JavaScript, or ActionScript world? They use completely different syntax, so don't fret about it. Nathan http://www.nathanderksen.com On Dec 29, 2005, at 10:05 PM, g.wygonik wrote: whew! thought i might have missed clever and cool in there! :-) though your comment did bring up some ideas i'll try in the AM. it's all whack in my book right now. like i told Jesse - it works, i'll keep it. time for bed! g. On 12/29/05, Claus Wahlers [EMAIL PROTECTED] wrote: __resolve? nope... not unless there's some super-secret way of using __resolve outside of the normal way. even with a __resolve function in-place in my class, you still get the dreaded Left side of assignment operator must be variable or property. when calling: session(foo) = bar; ah yes of course: non-singleton-version: var session:Session = new Session(); session(foo) = bar; this makes no sense. maybe: session.foo = bar; in combination with __resolve? or maybe even let getInstance return a method of the singleton rather than the instance itself? hmm no then the :Session type would be invalid.. i guess the only way to do that is using the standard dot-notation and __resolve. sorry can't test as2 stuff right now, but maybe it helps somehow ;) cheers, claus. -- weblog: broadcast.artificialcolors.com blazePDF: www.blazepdf.com band: www.cutratebox.com ___ 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
Re: [Flashcoders] Singleton as associative array - yucky icky?
Well, consider how an object can be manipulated. var myObject:Object = new Object(); myObject.foo = bar; or var myObject:Object = new Object(); myObject[foo] = bar; Those are equivalent syntaxes. Everything basically inherits from Object, so this is valid syntax throughout, including your custom classes. Basically, you are accessing (and apparently creating) properties on the fly, with no type checking, and no compiler validation as to whether the property being accessed actually exists. You can see a bit more of this if you consider the XML class: var myXML:XML = new XML(); myXML.foo = bar; In this case, foo is not a valid property of the XML class, so the compiler spits out an error. However, if you do this: var myXML:XML = new XML(); myXML[foo] = bar; the compiler happily allows it, and a trace on myXML.foo reveals the value bar. One more thing, the LoadVars class takes advantage of the fact that the class is just a collection of properties. It allows for the arbitrary addition of properties using both syntaxes: var myLV:LoadVars = new LoadVars(); myLV.foo = bar; myLV[baz] -= quux; myLV.sendAndLoad(foo.jsp); In many respects, LoadVars is doing what you want to do with your Session class. Fun, eh! Regarding number 2, that is what getters and setters are normally for. With arbitrary properties, someone correct me if I am wrong, but I don't think there is a way of intercepting them all, just specific ones that you have defined. Nathan http://www.nathanderksen.com On Dec 30, 2005, at 9:55 AM, g.wygonik wrote: lol - indeed. :-) i'm just trying to look at possible issues that may come up later on... but this scenario brings up two follow-up questions/concerns: 1 - the fact that Flash (AS2) will happily turn a class into an associative array without any sort of warning. if a coder comes in and uses session[foo], it will work with no errors thrown. can i catch this somehow? should they use this syntax throughout their modules, it will work with no problems, but won't be correct. 2 - can i somehow catch items being added to the class via the ass-array method and properly add them to the Items array instead of the root class? in other words, say a user does use the session[foo] method. can i intercept that call, add the item/value to the Items array and remove it from the class? i thought about some sort of watch, but i wouldn't know what to watch in this case... while i'm going to be setting up a proper API for them to use, in a way this conversation is over from a real world standpoint. but i'd like to figure this out from a theoretical standpoint now. g. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Singleton as associative array - yucky icky?
On 12/30/05, Nathan Derksen [EMAIL PROTECTED] wrote: while that is true, i thought that was what the dynamic keyword was to allow, and without it, you'd get some sort of error... That's the theory, but as the XML example shows, using the associative array syntax gets around the compile-time checking for that. In many respects, LoadVars is doing what you want to do with your Session class. well, in ways, yes - in ways, no. it's doing the same on-the-fly variable assignment, but doesn't have any other methods (like addItem) that would put keys/values into a specific class member. it seems that LoadVars just iterates over the object and outputs any property it finds (which is why onLoad=function used to appear in LoadVars data). i was doing iterations over both the class object and the Items member. i'd obviously prefer just to have one place for all props. Yah, that's why it is so much cleaner just to have an associative array as a private property within your class, and create addItem(), getItem(), and removeItem() methods to manage that associative array. That way you also don't have to worry about the names of added properties possibly colliding with existing property/method names within the class. Nathan http://www.nathanderksen.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] JavaScript to Flash Communication Compatability
I haven't seen an up-to-date chart either. You may be interested in knowing that Macromedia already has two ways for you to do this. The first is the Flash JavaScript Integration Kit: http://weblogs.macromedia.com/flashjavascript/ This uses legacy techniques to make what you are doing work in versions 8 to (I believe) 6, and works in Firefox 1.0+ and Opera 8+. The other one is the Flash 8 ExternalInterface class. I have an example up at http://www.nathanderksen.com/blog/?p=11 and you can find the documentation at http://livedocs.macromedia.com/flash/8/main/ wwhelp/wwhimpl/common/html/wwhelp.htm? context=LiveDocs_Partsfile=2200.html. Very slick, but the browser support isn't as good and it only works in Flash 8. Nathan http://www.nathanderksen.com On Dec 28, 2005, at 2:39 PM, Jeff Mastropietro wrote: I'm working on a project using JavaScript to call functions in a flash movie. I'm currently using the JSFCommunicator Library: http://www.abdulqabiz.com/files/JSFC/JSFCommunicator%20Library.htm What I would like to know is, is there a better object available? Also, I'm guessing that all solutions are going to be dependant on the .GetVariable and .SetVariable methods being available to JavaScript. Does anyone know of a more up to date compatability chart than this one? http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_14159 More specifically, I need to know compatability with Mozilla and Opera browsers. Thanks, Jeff ___ 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
Re: [Flashcoders] NumericStepper
At the end of your change() handler, save the stepper value to a timeline variable or class property, then next time compare the stepper value with that previous value. Lather, rinse, repeat. Nathan http://www.nathanderksen.com On Dec 29, 2005, at 12:03 PM, Mike Boutin wrote: I have a NumericStepper that changes the value of a price textfield based on the stepper value. Is there anyway to check if the user increment/decrement the stepper so I can muliply/divide the number when needed. Thanks var nstepListener:Object = new Object(); nstepListener.change = function(evt_obj:Object) { if (evt_obj.target.value == 0) { } else { var oldPrice:Number = proPrice.text; var step:Number = evt_obj.target.value; proPrice.text = oldPrice*step; } }; orderQuantity.addEventListener(change, nstepListener); ___ 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
Re: [Flashcoders] Flash Class Array bug - Please verify
Yes, when you assign an initial value to a property, it is basically like a static assignment. Do the initialization in the constructor instead. This works for me: class myClass { // initialize the array in the declarations var myArray:Array; function myClass() { myArray = new Array() trace(myArray.length=+myArray.length) } function addToArray() { myArray.push(10) } } Nathan http://www.nathanderksen.com On Dec 29, 2005, at 12:48 PM, Judah Frangipane wrote: Hi Glenn, Flash is still treating the array as a static member. // treated as an instance variable var myArray1:Array; // treated as a static variable var myArray2:Array = new Array(); Test this code: // in actions frame 1 import myClass trace(Creating instance a) var a = new myClass(); a.addToArray(); a.addToArray(); a.addToArray(); trace(Creating instance b) var b = new myClass(); // in class class myClass { // treated as an instance variable var myArray1:Array; // treated as a static variable var myArray2:Array = new Array(); static var myArray3:Array = new Array(); function myClass() { trace( myArray1.length=+myArray1.length) trace( myArray2.length=+myArray2.length) trace( myArray3.length=+myArray3.length) } function addToArray() { myArray1.push(10); myArray2.push(10); myArray3.push(10); } } Glenn J. Miller wrote: Hey Judah, Try this: class myClass { // initialize the array in the declarations private var myArray:Array = new Array(); function myClass { trace(myArray.length=+this.myArray.length) } public function addToArray() { this.myArray.push(10); this.myArray.push(20); } } // end class Run your code again, I think it'll execute the way you're expecting it to at that point... Peace... -- Dok Skyymap, Inc. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Judah Frangipane Sent: Thursday, December 29, 2005 3:30 PM To: Flashcoders mailing list Subject: [Flashcoders] Flash Class Array bug - Please verify It seems like Flash is creating static members out of public arrays that are initialized in the class declaration. Can someone confirm this? Is this not legal, is it implied behavior or a bug? // create a class called myClass class myClass { // initialize the array in the declarations var myArray:Array = new Array(); function myClass { trace(myArray.length=+myArray.length) } function addToArray() { myArray.push(10) myArray.push(20) } } // on the actions frame import myClass var a = new myClass(); a.addToArray(); a.addToArray(); a.addToArray(); var b = new myClass(); // trace outputs myArray.length=0 myArray.length=3 Judah ___ 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