All posts by Kawika

Export vector graphics from Flash CC to Illustrator CC

If you’ve used Adobe creative suite/creative cloud programs for any length of time, you know they have some big quirks. One of the things that as always irked me was how difficult it is to get Flash vectors into Illustrator, even though the other way is as easy as copy/paste.

Flash CC 2014 added a new “export to SVG” option, which is great – Illustrator natively supports SVG! However, in my experience, Illustrator often crashes when opening said SVG file. In order to not crash Illustrator, here are some instructions (I’m using the CC 2014 versions of both Flash and Illustrator):

  1. Copy and paste the symbol you’re exporting into a new FLA (this removes unused symbols).
  2. go into every symbol in the library and delete all empty/hidden/guide/code layers.
  3. go to file > export image and choose SVG.
  4. open the SVG file in Illustrator – everything should be there!

I found the workaround here: https://forums.adobe.com/thread/1573625

Flash Builder 4.7 crashes loading workbench OSX

Today I had a similar problem to the one in this post – but instead of hanging, Flash Builder just failed to start up and quit during the “loading workbench” phase of initialization.

In the earlier post, I mentioned deleting a .snap file in [workspacelocation]/.metadata/.plugins/org.eclipse.core.resources, but previously I hadn’t been able to find it. This time, there WAS a .snap file in that folder, but it was hidden.

Deleted it, and Flash Builder starts up like a champ.

Access iOS Simulator Logs directly

Sometimes I need to get NSLogs from an app running in the iOS simulator, but said simulator wasn’t launched through Xcode.

There’s a method listed in this stackoverflow post that works for me with Xcode 6.

In the simulator itself, you go to Debug > Open System Log… and it should open Console.app and come right up. If it doesn’t, you might need to try it more than once like I had to.

Screenshot 2015-09-28 20.41.55

If you want to access the log files directly on disk, it’s a bit convoluted. Direct quote from the stackoverflow page (in case link rot sets in):

In case you need it, this log is kept in Library/Logs/CoreSimulator/[device name]/system.log. To get [device name], go to Xcode, Window -> Devices and find the device that you are currently simulating. Look for the Identifier. Compare that against the folder names in Library/Logs/CoreSimulator and you should find a match.

Anatomy of a phishing attack

I got a phishing email today that purported to be from a credit-card company. I had a funny feeling about it, and I’m ashamed to admit it almost fooled me until I took a closer look. Here’s what it looked like. Can you tell what’s wrong with it?

Screenshot 2015-09-25 11.36.24

On closer inspection, I found quite a few things wrong with it, even though it had an attention-grabbing subject line. Here’s the email again, with some spots highlighted in no particular order:

Screenshot 2015-09-25 11.39.10

  1. From email address isn’t from anything remotely resembling americanexpress.com. This can be easily spoofed, though, so not phishing emails will have this problem.
  2. To email address: not my real email address. It only arrived in my email inbox because I have a catch-all address set up on my domain.
  3. The link they’re trying to get you to click does NOT go to americanexpress.com, but to american-express-d3s1.com – a dead giveaway.
  4. No American Express logo or branding of any kind? Suspicious.
  5. What is this even supposed to be? “For your security” with a random number?? It doesn’t even make sense!

Just goes to show, if you’re suspicious of an email, it never hurts to take a closer look!

Extract sounds and images from FLA in Flash CC with JSFL

Recently I learned that Flash CC dropped the ability to export WAV files! Dumb move by Adobe in my opinion, but what’s done is done.

After some Googling, I discovered this post on stackoverflow that contains a JSFL script to enable extracting sounds or images from the library of an FLA. It’s a few years old at this point, but I can confirm it still works for sounds as of Flash Pro CC 2014. If anyone has a more modern solution I’m all ears, but I’ll repost the code here in case that link ever breaks:

// Result of attempts to export will go to the output panel,
// so clear that first fl.outputPanel.clear();

// If bitmaps/audio in the library have been selected, export only
// those. Otherwise, export all bitmaps/audio in the library.

var lib;
if (fl.getDocumentDOM().library.getSelectedItems().length > 0) {
    lib = fl.getDocumentDOM().library.getSelectedItems(); 
} else { lib = fl.getDocumentDOM().library.items; } 

// Get destination directory for files 
var imageFileURLBase = fl.browseForFolderURL("Select a folder."); 
var imageFileURL; 

var totalItems = lib.length;
// Iterate through items and save bitmaps and 
// audio files to the selected directory.
for (var i = 0; i < totalItems; i++) 
{
    var libItem = lib[i];
    if (libItem.itemType == "bitmap" || libItem.itemType == "sound") 
    {
        // Check the audio files original Compression Type if "RAW" export only as a .wav file
        // Any other compression type then export as the libItem's name defines.
        if(libItem.itemType == "sound" && libItem.originalCompressionType == "RAW")
        {
            wavName = libItem.name.split('.')[0]+'.wav';
            imageFileURL = imageFileURLBase + "/" + wavName;
        } else {
            imageFileURL = imageFileURLBase + "/" + libItem.name;
        }
        var success = libItem.exportToFile(imageFileURL);
        fl.trace(imageFileURL + ": " + success);
    }
}

You'll need to save this to a file with a .jsfl extension, select any number of sounds or images from the library, and then go to Commands > Run Command in Flash Pro and navigate to the file. It'll ask you for an output directory and save the selected items there. If you don't select items in the library beforehand, it'll export all sounds and images found in the library.

To get the command to show up in the commands menu, put the file here:

Windows 7: boot drive\Users\username\AppData\Local\Adobe\Flash CC\language\Configuration\Commands

Windows Vista: boot drive\Users\username\Local Settings\Application Data\Adobe\Flash CC\language\Configuration\Commands

Mac OS X: Macintosh HD/Users/userName/Library/Application Support/Adobe/Flash CC/language/Configuration/Commands

filesystem data from here

Flash Builder 4.7 won’t reload SWC when it changes

According to this thread, Flash Builder will only notice when your library SWC changes if it’s in your project folder. Kind of sucks if you use the same SWC in multiple projects, like I do, but it appears to be the only option. Also, sometimes you need to clean the project to make the refresh happen.

Now, I’m not using the Flex framework, but also from the linked thread, if you use Flex you might be able to turn off a “global SWC cache.” I tried it for my plain-jane actionscript projects and it didn’t work.

Here’s the secondary method:

Find the .options file in the /Applications/Adobe Flash Builder 4.7/eclipse/plugins/com.adobe.flexbuilder.project_4.7.0.349722/ folder and look for a line like this:

# use a global swc cache across all projects when compiling with flex sdk 4 or higher
com.adobe.flexbuilder.project/useGlobalSwcCache=true

Try setting useGlobalSwcCache to false then restart Flash Builder and see if that helps.

NOTE: This may result in longer compile times in Flash Builder if your workspace includes Flash Library Projects since those generated SWCs will no longer be cached and instead will be rebuilt every time.

Again, I tried this secondary option, but it didn’t work for me (OSX 10.10.3 Yosemite), possibly because I don’t actually use Flex, and the comment in the config file specifically mentions Flex SDK.

Help! My computer is reading everything on screen to me!

If you are on a Windows machine running 8.1 (and maybe previous versions) and you accidentally press the windows key + enter, you’ll start up Narrator, an accessibility program that reads everything on the screen to you.

To turn it off, press caps lock+escape.

It doesn’t appear that you can turn off the keyboard shortcut :(.

Found here.

Mac OSX keyboard stuck in overwrite mode on Windows? Press 0

If you’re remoting in to a Windows box from a Mac, and using a (fullsize) Mac keyboard, you can accidentally get stuck in overwrite mode (instead of the normal insert mode) when entering text.

This happens because the Mac keyboard does not have a dedicated INSERT button like Windows keyboards do.

The solution is to press CLEAR on the OSX numberpad until you’re sure NUMLOCK is OFF (i.e. you press the numberpad buttons and the cursor moves instead of numbers appearing). Then, you can press the 0 key, which serves as an INSERT replacement (but only when NUMLOCK is off!), to get your cursor back to INSERT mode.

See here for more information about NUMLOCK on a Mac keyboard.

Mac OSX number pad not working in Windows? Press CLEAR

If you’re using a fullsize Mac keyboard, but remoting in to a Windows box, there’s no dedicated NUMLOCK button to turn NUMLOCK on and off. However, there is a CLEAR button which seems to serve the same purpose. If you get stuck with NUMLOCK off, you can press CLEAR to turn it back on. Sometimes you may have to press SHIFT + CLEAR instead.

Screenshot 2015-05-18 17.07.30

You’re welcome.

via OSXDaily

Self-hosted adhoc IPA delivery of iOS apps

Although this may be old hat for many, I recently learned this from an iOS project I’ve been working on.

With the acquisition of Testflight by Apple, you can now do iOS beta-testing directly through iTunes Connect, and you don’t need device UDIDs to get your adhoc IPAs on your testers’ devices. But what if, like this recent project, you have to target iOS 7 (Testflight beta testing from Apple only works on iOS 8 and up)? And what if you don’t want to wait for Apple’s beta review process before a beta app goes out?

In that case, you can host your adhoc IPAs for download on your own server. First you have to do the old process of getting device UDIDs from your testers, entering them into iTunes connect, and creating a distribution provisioning profile with those devices enabled.

Once you’ve done all that, and you’ve created your adhoc IPA, you can go ahead and upload that file to your server. Remember where you put it, because you’ll need the full URL to your ipa in the next steps.

Create a .plist file on your server with the following data in it. You’ll need to enter the full URL to your IPA, the bundle ID of your app, its current version, and its name. Make sure to remove the brackets from the code below when entering your values.

Sample .plist file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>items</key>
	<array>
		<dict>
			<key>assets</key>
			<array>
				<dict>
					<key>kind</key>
					<string>software-package</string>
					<key>url</key>
					<string>[http://yourserver.com/path/to/ipa]</string>
				</dict>
			</array>
			<key>metadata</key>
			<dict>
				<key>bundle-identifier</key>
				<string>[com.yourcompany.yourgame]</string>
				<key>bundle-version</key>
				<string>c[urrent version of your app]</string>
				<key>kind</key>
				<string>software</string>
				<key>title</key>
				<string>[name of your app]</string>
			</dict>
		</dict>
	</array>
</dict>
</plist>

Save that as a .plist file, and upload it to your server. Remember the full URL to the .plist file.

Next, create a HTML file on your server with the following code in it, replacing the part with the full URL to your plist:

<a href="itms-services://?action=download-manifest&url=http://yourserver.com/path/to/plist">click here to install<a>

Navigate to that page on your device, click the link, and it should work! (assuming the adhoc provisioning profile you built your app with contains permissions for your device)