today, i was working on a problem that involved TextField, and more specifically, using values from the last line of text. i was trying to get the TextLineMetric of the the last line to do some calculations. this was all fine and dandy until I coupled this new utility with another that modifies the htmlText property of the TextField i was working with. here is what i learned:
changing the value of htmlText on a TextField always creates one extra empty line of text.
i found no indication as to why, and i could see by doing plenty of traces that the htmlText did not indicate to create any new line of text.
so here is the fix:
textField.replaceText(textField.text.length - 1, textField.text.length, "");
apparently that grabs our magic extra line and gets rid of it. great.
i may update this post to include some of the test that i did which proved that changing htmlText always results in this extra line, but another time.
viruses
a frustrated ktu i have been for the last two weeks.
i got a virus on my laptop. a sneaky little guy which i am pretty sure ended up being an infected driver. in spending time trying different sources to remove it i may have finally done so, but have yet to plug the drive back into my laptop to verify this.
this prompted me to yet again think about getting a new computer. my current laptop has been degrading gracefully but it is now to the point where i just cannot take it anymore. from overheating issues to hardware buttons not working and having no battery, it is not a pleasant machine to deal with. i am moments away from finalizing my setup.
but this has caused massive delays on my projects. two weeks of frustration and anxiety about the money i will be spending have left me doing no work whatsoever.
linux
this brings me to the second part of the post. while trying to fix my drive, i plugged in an old 40gb drive that had ubuntu on it. i feel like sharing my experience with linux so far.
as a long time windoze user who has always wanted to switch to linux, my first impression is disappointing. i have never had so many difficulties. alt+tab is super slow, the unity dock is poorly designed, i cannot seem to get mail setup, and using two monitors was very difficult. i know i need more time with a new environment and i am certainly not giving up on linux. in fact the appeal of being able to fix the crap i do not like is certainly going to drive my understanding of computers, logic, and development.
so, adding another project to the list (learning linux) will definitely distract me from my other projects, but i am the kind of person that needs to flip back and forth to maintain interest and motivation.
i truly hope to be back on track very soon as i have a lot of goals i want to meet.
The goal: more reusable components, more functionality, and a way to collect anonymous data and using the “Security Settings panel” (from livedocs).
New features / Changes:
- Settings Panel Proxy
- Media Permissions
- CameraDetection
- MicrophoneDetection (if people want)
- LoggingCameraDetection
The Settings Panel Proxy will almost be a project of its own. For a while I’ve toyed with the idea of a proxy for the Settings panel. Ideally, this will allow you to open the panel, be notified when values change, and be notified when it closes. Gone will be the hassle days of having to deal with that stupid box. If you ever work with media input devices or local shared objects this will make you happy.
Media Permissions was a previous abstraction that is technically no longer needed because of the Settings Panel Proxy. However I think re-purposing that functionality to something more simple is beneficial. You could do something like:
var mp:MediaPermissions = new MediaPermissions (stage);
mp.addEventListener (MediaPermissionsEvent.RESOLVE, onMediaPermissions);
function onMediaPermissions (e:MediaPermissionsEvent):void {
trace ("permission was " + e.code); // 'granted', 'denied', 'noDevice'
}
Anyway. I have been moving forward just fine. I’ll keep you posted.
Never Ever Ever put a textfield anywhere except on whole integer values
textfield.x = 100 :)
textfield.x = 99.8 :(
Seriously, do you want you text to look good?
#5000
I ran across an issue concerning compile error #5000: The class ‘fl.containers.UILoader’ must subclass ‘flash.display.MovieClip’ since it is linked to a library symbol of that type.
I’d seen this before, but not with a built in component. After my google foo brought me round and back twice I finally ran across a page where the user had created two functions with the same name. Changing the function name fixed the compile error. It’s too bad the compile error that was fixed was not related to the actual problem. So I considered similar options in my case.
My solution: CamelCase your class names. The original developer had set a bunch of MovieClips to export for actionscript, however he had used all lower case letters. CamelCasing the class names fixed the compile error.
Let’s look at the normal case that this error shows up in.
You create a movie clip in your library. In the properties, you select ‘export for actionscript.’
Then you create a .as file for that movie clip but extend Sprite instead of the expected MovieClip.
Make sure when exporting a movie clip in your library for actionscript that the external .as class file you make extends the same class that you have referenced in the library.
