Swap library items of an instance on the stage. I was having some problems with the simple(r) version from FuelJSFL. Mainly, the instance’s “Instance behavior” setting (changing from a “button” to “movie clip”, for example) is not updated using the dom.swap() method. Plus Fuel’s won’t work on locked layers.
Pick two library items, and all instances on the stage are swapped from the one item to the other.
Code (cf., for code highlighting):
Read more…
Adobe Flash JSFL quirks notes:
- Text boxes may store line returns as \r, rather than \n or \r\n.
- Because of this, the beginning of line symbol may not work.
- Wrong: string.replace(/.*^.*/, “$1″);
- Right: string.replace(/.*\r.*/, “$1″);
- Non-greedy seraches don’t always work, and may not work with multiline searches. Try a greedy search instead, if possible. Headache == string.replace(/^(.*?)\r(.+?)/m, “$1″).
- Using fl.findObjectInDocByType(),
- [obj].keyframe = The keyframe that the element is on.
- [obj].layer = The layer that the keyframe is on.
- [obj].timeline = The timeline that the layer is on.
- [obj].parent = The parent of the timeline. E.g., the timeline might be in a symbol instance.
And finding the layer and frame:
- dom.getTimeline().currentLayer = dom.getTimeline().findLayerIndex(findObjResults[j].layer.name);
- dom.getTimeline().currentFrame = findObjResults[j].keyframe.startFrame;
- Using:
var dom = fl.getDocumentDOM();
var lib = dom.library;
Find a library item:
var libItem = lib.getItemByname( libItemRef );
Find a library index:
var libIdx = lib.findItemIndex("folder-as-path/to/library/item/name");
Select an element on the stage:
fl.selectElement( someStageElementRef, false );
Swap element’s library item with another library item:
dom.swapElement( libItemToChangeTo.name );
- For basic stage DOM search (and swapping) for library item instances see my post on JSFL swaps.
You do not need a Mac to get the UDID of a device (iPhone, iPad, etc.). You can use iTunes, or have the UDID emailed to you.
Here are two different ways to do it, and you can pick which is easiest:
iTunes method:
- Plugin your iPad to the computer and start iTunes.
- Select your iPad on the Devices list on the left hand panel.
- Click on the Summary Tab.
- Now click on the Serial number (the actual text “Serial Number”) to see the serial number and other detail. At some point, the text will change to the phrase “Identifier (UDID)” followed by a series of characters. Send the characters to whoever needs them.
App Store method:
- On your iPad, go to the “App Store”.
- Type “udid sender” in the search box at the top left corner.
- Install UDID Sender.
- Run UDID Sender, and have it email the UDID to whatever email address.
I guess I recommend the iTunes method, simply because you have to get iTunes working between your computer and iPad anyway for app testing. There are quite a few steps to getting everything working properly, but iTunes will prompt you as you go, so it is pretty painless.
None of this requires a Mac. This will work on Windows . . . I generally use Windows for development, so I know this through practice. Specifically, app testing does not require a Mac. Ad hoc publishing can be done with Adobe Air solutions and a Windows PC, and you can email your ad hoc app to everyone who needs it.
Free tools for making Adobe Air apps for iPhone, iPad, etc. These tools and much of the process can also be used for making Android apps.
There are very good instructions for developing apps on Windows for developing iPad and iPhone apps on a Windows machine from an Untold Entertainment blog tutorial. (Adobe has an adequate, but inscrutable doc on the process, too.)
This process uses Adobe Air to create iOS apps.
But why use Adobe Air?
Read more…
Lots of discussion out there about making each line some different color in a ComboBox. But it is really simple — just not well explained.
comboBoxInstance.setStyle("alternatingRowColors", [0xff0000, color 2, color 3, ...]);
‘Alternating’, in this case, really means “use a list of colors, and repeat the list if there are more lines than colors”.
I searched for a long time to find a solution to the whole “resize an iframe to fit the content height” problem. Basically, browsers lock the content server (which provides the iframe src data) away from the parent server (which hosts the iframe) and vice versa. You cannot access the iframe content at all, on any level, from the parent server. This is pretty much insurmountable.
So the workaround is to use an HTML5 feature called “postMessage”. The caveat is that you have to have editing access to the client (remote) webpage. This negates the value if you are trying to show websites like Google; it does allow webmasters to tell their clients how to create their pages to have them show up.
Read more…
I wrote an article (tutorial) for BlenderArt, issue #29, called “Creating Blender icons for Adobe Flash”. Yay me!
“Creating Blender icons for Adobe Flash.” Blenderart Magazine 23 Sep. 2010: 8-14. Web. 4 Oct 2010. <http://blenderart.org/issues/>.
Read it online or download it (as PDF).
Enjoy!
- 30 -
I have been receiving this error occasionally. I use SVN for backup and versioning, and Flash Builder does not work well with it at all.
How I come across this error
I think FB may be using SVN; if I delete the ‘bin-debug’ directory, it is immediately recreated along with the ‘.svn’ directory. There are SVN conflicts and errors that cannot be ‘resolved’ or ‘cleaned’ using SVN because of this.
The solution I have found that works is to make my copy of SVN to ignore the ‘bin-debug’ directory. However, if I forget to do that, then I have had to delete either the entire ‘bin-debug’ directory or some files within it.
This creates the problem in FlashBuilder. If you delete the HTML file associated with the project, it’s doom and frustration from that point on. I have not found a good working solution – FB ‘clean’ does not work, closing the project and deleting the ‘bin-debug’ dir does not work, nor any solution I have found.
What might correct the problem
This is going to be my next attempt, if anything like this happens again.
http://stackoverflow.com/questions/290768/flex-builder-3-executing-old-source-codes/1738581#1738581
(which links to: Flash workflow and the danger of careless SWCs)
Note that I am NOT referencing the initial and recommended responses. They don’t work. I am referencing the post that talks about SWCs . . . it’s the only solution I haven’t tried yet.
This is the complimentary Photoshop script that is referenced in an article I wrote for BlenderArt, issue #29, called “Creating Blender icons for Adobe Flash”: Read it online — Download it (as PDF). Enjoy!
Code follows: Read more…
Rule #1: Never save what you don’t have to.
In response to this post, using SharedObjects to store data is useful but can be easily misused. I have not tried out serialization of objects, so there may be easier solutions to implement, but in my experience, many XML attributes and elements are fairly formalized, except for text areas.
This means that you can represent most XML data with bits: e.g., is this a checkbox or radio area (0|1); are there 4 items in the list or 5 (again, 0|1); which item is selected (use a n-bit array to indicate status, or just save the index # of the active one); etc. Make a bit array that represents your XML data, and then compress all text to use the space well.
Also, take advantage of default settings. If you store a 0 in a bit, have that represent the default value: an empty string in a text area, “submit” for the button text, etc.
No matter what, you definitely want to go beyond the toString() method. Of course, if you only are ever going to have a little bit of data for each user, then just save the whole XML to a SharedObject.
Rule #2: Don’t do any programming that you don’t have to!
- 30 -