My recent flex adventure almost came to a crashing end when I shut down and restarted Eclipse, only to find that my file's project properties could no longer be read?!?! I got very angry trying to figure out what happened, thinking to myself that I recently tried committing my project to SVN via subclipse (which is another story on its own). One thing I'm very happy I did was create a backup before trying to commit. Pretty much every time I tried to open my project I got the project properties files could not be read. I looked at the .actionScript and .project files, and couldn't see anything missing. I looked high and low, and ran a -diff on my project and the backup copy. Turns out, I was missing the .flexProperties file. How that got deleted from the project I don't know, but it was horrifyingly maddening to only get a mystic message saying the project properties files could not be read. Which files?!? A better message would be preferred, but alas, I copied the old over to the project folder, and I'm back in shape. Lesson learned, if you get this error, make sure you have all three project files in the correct location (aka CYA).
Thanks to Ben Clinkenbeard and Eric Hélier for getting me in the right direction!
LordB8r's ramblings, notes, and posts. These are my thoughts and answers to my own expirements on Ruby, Rails, Flex, Python, Django, PostgreSQL, MongoDB, Scala, robots, independent contracting, coffee, scotch, beer, and anything that makes me curious (just not tax codes, anything but tax codes).
Wednesday, January 13, 2010
Monday, January 11, 2010
Massive amounts of memory consumption via image swapping in Flex
On my project, I was using De MonsterDebugger (DMD) (great tool, easy to implement, but can get heavy if you don't have a lot of RAM - peaks at about 150MB for me, which can hurt because I'm running on only 2 GB). In my project, I am rolling over canvases, and on each rollover, the background of the application should have its images change. My initial development had me doing this by changing the style of the Application (application.setStyle("backgroundImage",assets/myNewImg)). And to make the transition smooth, I had a second Image that I was using on top of the background, but underneath all the other components (z level = lowest possible).
The problem quickly became clear (even more so w/ DMD because I could see why my computer would stop responding when debugging, i.e. my RAM usage was spiking). In the last several days I have been reading about garbage collection (GC) and how it seems to act on its own accord. It was happening w/ my app, which would always return to about 40MB in runtime, but could (and often did) spike upwards of 250MB!!! All that for a single swf file running in Safari. I checked my objects, commented out different things (including custom turtle border graphics), and went through item by item that could've ran up so much RAM.
Finally it came back to my images being swapped in and out. I thought the image class could handle changing sources quickly, but it turns out, that was eating huge resources to render the image (all while doing some lightweight tweening). I tried my best to build this application to follow OOP and reusability as best as I could. The data source (an xml config file) is what drives the layout and information of the app, so I wanted to avoid embedding anything that needed to be called up explicitly w/ a case/if. But alas, I could only do so much before I had to make some exceptions in my class and embed the background images, and use a case statement to assign it correctly on hover. Once here, and once I realized that changing two background images (one stacked on the other to allow me to transition smoothly - read fade - meant I needed two images).
My app now only spikes at about 68MB, no matter how many transitions I make, and I don't have to try to force GC (which eventually happens during idle time). The last thing I think I'd like to try is possibly improving the cpu performance and keeping the fan from getting hot by adjusting frame rate, but for now, I'm happy that my app doesn't spike so much anymore.
The problem quickly became clear (even more so w/ DMD because I could see why my computer would stop responding when debugging, i.e. my RAM usage was spiking). In the last several days I have been reading about garbage collection (GC) and how it seems to act on its own accord. It was happening w/ my app, which would always return to about 40MB in runtime, but could (and often did) spike upwards of 250MB!!! All that for a single swf file running in Safari. I checked my objects, commented out different things (including custom turtle border graphics), and went through item by item that could've ran up so much RAM.
Finally it came back to my images being swapped in and out. I thought the image class could handle changing sources quickly, but it turns out, that was eating huge resources to render the image (all while doing some lightweight tweening). I tried my best to build this application to follow OOP and reusability as best as I could. The data source (an xml config file) is what drives the layout and information of the app, so I wanted to avoid embedding anything that needed to be called up explicitly w/ a case/if. But alas, I could only do so much before I had to make some exceptions in my class and embed the background images, and use a case statement to assign it correctly on hover. Once here, and once I realized that changing two background images (one stacked on the other to allow me to transition smoothly - read fade - meant I needed two images).
My app now only spikes at about 68MB, no matter how many transitions I make, and I don't have to try to force GC (which eventually happens during idle time). The last thing I think I'd like to try is possibly improving the cpu performance and keeping the fan from getting hot by adjusting frame rate, but for now, I'm happy that my app doesn't spike so much anymore.
Thursday, January 7, 2010
Smooth scrolling of a horizontallist
So I tried various makes of horizontal scrolling a horizontallist. I followed these examples, yet either my canvas never added the hlist (because the canvas initialized after I added the hlist, so the hlist was garbage collected before it's parent was initialized), or the scroll bar never moved the list (although I came close to rewriting the scrollhandler function. Suffice it to say, finally my hack involved adding the hlist to my canvas through a calllater(addHList), and then having external buttons be able to scroll my hlist left and right a designated amount based not on the scroll bar of the parent canvas, but on the x coordinate of my hlist. Simple enough! I don't need to worry about overriding the location of the scroll bar, and now i can use something like tweenmax to handle the transitioning of the horizontal lists position, so i get scrolling, and external buttons to move my hlist, and i get all the benefits of an hlist (which has as many columns as i need because i set its columncount = dataprovider.length. if anyone wants to see code, let me know and i'll post an update.
private function scrollHorizontalList(e:Event):void{
var dir:String = e.currentTarget.name;
var end:int;
var pos:int = hList.x;
var max:int = hList.dataProvider.length;
var myTween:TweenMax;
trace(dir);
if(dir == "rButton"){
end = pos + colWidth;
if(!TweenMax.isTweening(hList)){
//if(hList.x-colWidth*colsToScroll)
myTween = new TweenMax(hList,1,{x: hList.x - colWidth*colsToScroll, ease:Cubic.easeInOut});
myTween.play();
hListScroll+=colsToScroll;
}
} else if (dir == "lButton") {
end = pos - colWidth;
if(!TweenMax.isTweening(hList)){
myTween = new TweenMax(hList,1,{x: hList.x + colWidth*colsToScroll, ease:Cubic.easeInOut});
myTween.play();
hListScroll-=colsToScroll;
}
}
lButton.enabled = (hListScroll > 0)?true:false;
rButton.enabled = (hListScroll < max-colsToScroll)?true:false;
}
private function scrollHorizontalList(e:Event):void{
var dir:String = e.currentTarget.name;
var end:int;
var pos:int = hList.x;
var max:int = hList.dataProvider.length;
var myTween:TweenMax;
trace(dir);
if(dir == "rButton"){
end = pos + colWidth;
if(!TweenMax.isTweening(hList)){
//if(hList.x-colWidth*colsToScroll)
myTween = new TweenMax(hList,1,{x: hList.x - colWidth*colsToScroll, ease:Cubic.easeInOut});
myTween.play();
hListScroll+=colsToScroll;
}
} else if (dir == "lButton") {
end = pos - colWidth;
if(!TweenMax.isTweening(hList)){
myTween = new TweenMax(hList,1,{x: hList.x + colWidth*colsToScroll, ease:Cubic.easeInOut});
myTween.play();
hListScroll-=colsToScroll;
}
}
lButton.enabled = (hListScroll > 0)?true:false;
rButton.enabled = (hListScroll < max-colsToScroll)?true:false;
}
Tuesday, January 5, 2010
Eclipse .ini changes
FB3 breaks then fixes, all because I forgot an 'm' in my init file. Actually, I was trying to change the min, max, and permanent sizes of my eclipse runtime, and I accidentally deleted one of the 'm's, and then eclipse never started or worked for me again. I got really angry, wasted 30 minutes trying to figure out what happened, including trying to read the logs and see where it went wrong, and finally decided to skip ahead and reinstall eclipse (3.4.2 of course, as FB3 won't work on 3.5, although some have figured it out…) So long story short, I reinstalled, did the software update to re-attach FB3 plugin (the new 3.5 sdk rocks!), and then couldn't get SVN to attach via subclipse. Another half hour later, and I returned to my .ini file, checked it against my old install, found the missing 'm', almost kicked myself, fixed the 'm', and now I have everything back in order…how annoying! Although, now Aptana makes things a bit slower...anyone else having that problem?
Tuesday, December 15, 2009
Flex, AR and speed improvement
I am working on an AR project for a client when I ran into major performance issues. It drove me batty because I tested out a bunch of stuff and couldn't get the performance up. For starters, I am using a dae file (standard stuff), then I load it in using collada, and that's where the crap started bottoming out. I tried multiple ways to fix it, testing whether it was my app, the dae, the AR, or what! I even connected w/ ARToolworks and Eric Socolofsky. They made some suggestions, like using Windows to take advantage of FP10.1.5's newest drivers which are great on the graphics card (but don't help me because I'm on a Mac). Instead, after countless hours and angry griping, I happened upon a small discovery, the rendering engine in Papervision. This little sucker is rendering my dae and making my 3D model work. Well, it was using Quadrant, which was eating up about every resource to make my model look nice and smooth. Once I switched that to Lazy, I got a huge performance boost (going from 1-2 fps up to 10-11 fps).
Thursday, December 10, 2009
Who works in a corporate environment and is allowed to use FB4 yet?
FB4 - oh how I pine for you!
Actually, I wanted to create my latest project in FB4, utilizing the pleasures of the vector class in FP10, but alas, my compatriots managed to convince me that the upgrade isn't necessary yet.
Is there anyone out there who's corporate policy is banning them from using the beta product to develop apps? If they do, how do you get to play (aside from on your own time?)
Actually, I wanted to create my latest project in FB4, utilizing the pleasures of the vector class in FP10, but alas, my compatriots managed to convince me that the upgrade isn't necessary yet.
Is there anyone out there who's corporate policy is banning them from using the beta product to develop apps? If they do, how do you get to play (aside from on your own time?)
Tuesday, December 1, 2009
Dreamweaver and CS4 killing performance
Is Dreamweaver running slow for anyone else who does Flex development. I'm not on a great machine, but I'm running a MacBook 13" w/ a 2.16 GHz Core 2 Duo, and 2 GB of Ram, but I do love my MacBook, and get quite frustrated by the fact that when I open up most of my CS4 products, my computer can come to a grinding halt. Actually, it's mostly just Dreamweaver, which I'm using for reading, writing and editing C#. I've thought about running my XP partition, then running visual studio for the coding, but that'd take up just about as much resources as me running Dreamweaver. What I don't understand (and maybe it comes from being spoiled by a wonderful Eclipse community), but why is Dreamweaver so unwieldily and ugly and hard to use? I'm happy that I can edit multiple languages with it, but frankly, I would've been happier if netBeans or even Eclipse let me work on it. It's annoying! But regardless, I'm trying to figure out what is killing my cpu? I do know and have configured my Eclipse for larger memory management (I believe I set the min at 84, and the max at 1024), but I'm almost never using all of that. Aside from a few smaller apps (read: iTunes, Adium, Thunderbird), I'm at a loss for such inefficiency.
Subscribe to:
Posts (Atom)