Extending Spark TextInput to auto-resize - actionscript-3

Hi have a Spark TextInput control but I haven't figured out a way to make is auto-resize...Does anyone have any code to get started?

I have no code, but I guess it shouldn't be too hard. you should simply watch changes, and then grab the new text size. I don't have flex 4 right now, but I guess you should take a peek into the sources and try to drill to the used TLF-components to get the size.

Related

gizmo based on Three.js is not visible

I created Forge viewer app w/ Transformation Extension based on GitHub sample "forge-extensions", for unknown reason, gizmo is not visible after I click on element, only very small yellow dot after zoom in, I believe it's element center point and gizmo size is too small, so my question is how to control it? in fact, all the coding is copied from that GitHub sample "forge-extensions", I must miss something simple!
Have you tried your code with different types of models, and does it behave the same for all of them? I believe it may have something to do with the scale of the particular model, especially when looking at these lines of code from the viewer extension:
_transformControlTx.setSize(
bbox.getBoundingSphere().radius * 5);
Try and put a breakpoint there, and see what the radius is. Or try adjusting the hard-coded value.

SparkAR How to change the lips size with code?

Im creating a new filter effect but i wanted to change the size of the lips. I thought that the faceDistortionPack will solve the problem but it only widens it. I need to expand the upper lip and the lower. So i think it's necessary to script the code but i don't know about that. I tried to create one based on the tutorial in the site but it doesn't work. Can you help me?
The easiest way is to use Sculptgl to make the face deformations.
Upload the "faceMesh.obj" (found in Face Reference Assets: Face-reference-assets-classic.zip)
Make the changes you want in the face and save the new .obj
Spark Ar: Add a new Face Mash in your faceTracker OR use an existent one.
Select the Face Mash, go to "Deformations" -> Import New 3D Object
Voi a l

Lean and mean table for AIR mobile

I'm sure a lot of people need this, but so far I have not been able to find a good solution.
Environment: AIR app for iOS and Android created with Flash CS6.
What I'm trying to do: Display a table (5 columns, 200 rows). Nothing fancy, just text data. The table should be sortable and scroll smoothly in response to swipe gesture.
The DataGrid component is too "heavy" and not recommended for mobile. Is there a simple solution for this?
For table display (even fancy) I would use the StageWebView, of course if you can afford to not be able to overlay anything over it.
Quick Sample below:
webView = new StageWebView();
webView.viewPort = new Rectangle(0, 44, 480, 756);
webView.loadString('<html><head><style type="text/css">tr:nth-child(odd) { background-color:#eee; } tr:nth-child(even) { background-color:#fff; } .header_button { width:100%;}</style></head><body><table width="200" border="1"><tr><td><input name="Name" type="button" value="Name" class="header_button"></td><td>Id</td></tr><tr><td>Mark</td><td>0</td></tr><tr><td>Bob</td><td>1</td></tr></table></body></html>');
webView.stage = stage;
you should read through documentation as loadString is pretty limiting:) to see all possible ways of using this class, but the idea should by planted in you by now:) e.g. CSS, JQuery etc. can be used, and scrolling is really fast:)
I haven't tried them yet, but Mad Components (technically it's the Extended Mad Components lib) has a UIDataGrid class.
Other than that, since your grid/table is only intending to display text, you might want to give the components from Adobe a try. Their grids are flexible, and as a result can be "heavy".
Since you only want to render text, you won't pay the price of trying to render heavier objects (check boxes, buttons, etc) inside the grid. The performance (when only rendering text inside the grid) may be acceptable.
Forget the Flex DataGrid, even with static text you won't get acceptable scrolling performance (I got about 5fps for a real time data grid).
The way to go is a normal List with a custom LabelItemRenderer and a button group for the header. You can make the renderer look like a grid very easily.
I haven't tested Alex Harui's list based grid, but it should work out of the box. If not, you should get the idea. Just roll your own AS3 based renderer and performance should be over 25fps even with fast scrolling. I get around 30 on an iPad2.

Add text to Alternativa3d?

I'm creating an app with Alternativa3d (8.17.0), and would like to add labels to some cubes. But it doesn't seem like the Alternativa API provides a way to do it...
Now I know I can either:
Add a TextField to the Flash display list in the normal manner
Render the text as a bitmap beforehand and upload as a resource to the GPU
Render the text to a bitmap at run time, and upload as a resource to the GPU
BUT I need the content to be added directly to the Alternativa cube (which precludes the first option) and the text is dynamic (i.e. not known at compile time - precludes the second) and the third just feels hacky.
Is there a clean way to do this?
Depending on how you want the text displayed you could do a number of different things..
You could use a Sprite3D and add the text rendered as a bitmap. You can place the sprite3d near the cube and it will always face the camera so as you move around the cubes they will appear in 3d space but facing you at all times.
Another option is to add it to the actual cube as suggested by danii using a movieclip. However the link to that MovieClipMaterial is no longer valid and is actually for a previous version of Alternativa not version 8. I have created my own movieclipmaterial for version 8 here ( http://davidejones.com/blog/1392-moviematerial-alternativa3d-8/ ) should you want to do that.
Lastly you could render the text to bitmap and merge this with the cubes bitmap so the text is layered on top and then set this material onto the cube.
Personallt i'd use the sprite3d method its alot easier and i think will give a better effect. Take a look at this example which uses the same effect ( http://gkb40.ur.ru/web/map40a3d.swf )
Just put your TextField inside a MovieClip, and use the class MovieClipMaterial to set that MovieClip as a material for one of the sides of the cube.

Unknown error AS3

Well, it's not an error, actually. I have wrote a game. There is only one keyframe on the main timeline (I don't mean one layer, there are lots of them, just like different MovieClips). Currently, I'm not using TextField anywhere, but I want to, because I need to display score on the screen. When adding TextField through Flash CS5 and naming it, when compiling, unknown window appears, you can see it on the picture. Not quite sure what it means. When clicking OK, window disappears but instead of my program there are three dots on the screen, you can see them also. I have no idea, neither of what is this, or how to fix it. Any hints? Thank you in advance :)
By the way, on one of the pictures, you can see what the game should look like. And as I said, it does, until I add some TextField to it.
it seems that you're using the TLF (text-layout-framework) in your textfield by accident.
this is a RSL (runtime shared library) that the flashplayer has to load before it can show your content. (and i think the dots are some kind of preloader that adobe puts in there ...!?)
but you don't need the TLF, you can just use a simple TextField.
select your score-textfield and choose "classic-text" in the properties window ... think that'll remove the TLF from your project. (if you have more than one TextField, check every one of them for "TLF text" and change it to classic).