Categories
Extending Flash Flash

Readable trace JSFL

Oke I’m getting into it, after comment trace JSFL and uncomment trace JSFL I created another trace related JSFL command.

It’s a extension on a trace that really says nothing;
you are testing the code you just written
trace (thisVar);
but you really want to:
trace ('thisVar: ' + thisVar);

And now you can: change the first trace into the second, more readable trace with just one click

How to install:
Save [mck] Readable trace.jsfl in the jsfl commands folder or just use the installer:

Read more about the Extension Manager

Limitation:

  • Only in one frame
  • When you use in the Action (F9) panel, the ‘pin active script’ to pin a couple of frames with actionscript, it doesn’t work

Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.

Any requests?

Categories
Extending Flash Flash

Uncomment trace JSFL

Oke I did the damage, I will fix it….

In my previous post about comment trace JSFL I made it possible to comment all traces in a actionscript frame.
Well now I’ve made a JSFL command to make it possible to undo that.

Example:
// trace ("something");
becomes
trace ("something");

How to install:
Save [mck] UnComment trace.jsfl in the jsfl commands folder or just use the installer:

Read more about the Extension Manager

Limitation:
(it has the same limitations as [mck] Comment trace)

  • Only in one frame
  • When you use in the Action (F9) panel, the ‘pin active script’ to pin a couple of frames with actionscript, it doesn’t work
  • words with trace in it… example var traceThis = "foo";
  • Will not Uncomment block comment (/* ….. * / )

Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.

Any requests?

Categories
Extending Flash Flash

Comment trace JSFL

Do you recognize the following situation?
You have to change a small thing in a FLA that colleague / freelancer made.
So you open the FLA export it, and the output window get filled with numbers, variables, booleans and other trace comments…

Of course you know that a trace should be removed after it did what you put it in for, but not everybody knows that.
So you decide to remove the traces in the actionScript layer:

  1. CTRL + F (find)
  2. Type in Find what: “trace (“
  3. and type in Replace with: “// trace (“
  4. press Replace button

or

  1. Commands
  2. [mck] Comment trace

(you can even give a command a keyboard shortcut)

It’s one of the features that I love from SE|PY, the AS-editor I’m using when I’m not scripting in the Flash IDE editor.

How to install:
Save [mck] Comment trace in the jsfl commands folder or just use the installer

Read more about the Extension Manager

Limitation:

  • Only in one frame
  • When you use in the Action (F9) panel, the ‘pin active script’ to pin a couple of frames with actionscript, it doesn’t work
  • words with trace in it… example var traceThis = "foo";

Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.

Any requests?

Categories
Extending Flash Flash

About extending Flash

I recently started to get interested in JavaScript Flash (JSFL) and I’m really impressed with its ‘power’.
As the title says: it extents the Adobe Flash authoring environment: you can add commands, new tools / panels, behaviour, actions, templates, and much more. You can make Flash do stuff it can’t do out of the box.

Extension are not only used in Flash but can also be used in other Adobe applications, but I can only focus on Flash.

The Flash JavaScript application programming interface (JavaScript API) is a complementary programming tool that lets you create scripts that run in the authoring environment.

source

There some things you need to know, and this post will explain some of them, and will be used by me in other post about extending Flash (so I have to explain it once):

Commands

Commands can be found in the Flash under Commands (seems obvious..)

I will post the commands here without a installer so you can learn from it.
But this file can also be used and copied in the correct folder it will work.
Commands can be placed in the correct folder, and can be used without restarting.

So right mouse button (save file… ) and save/copy the file to the command folder.
Flash 8

C:\Documents and Settings\[username]\Local Settings\Application Data\Macromedia\Flash 8\[language]\Configuration\Commands

Flash CS3:

C:\Documents and Settings\[username]\Local Settings\Application Data\Adobe\Flash CS3\[language]\Configuration\Commands
Remember to look in the “Local Settings” folder for the “Application Data” folder!
Flash 8 was made by “Macromedia” but this company was bought by Adobe so Flash CS3 can be found in the “Adobe” folder

Flash panels

Flash panels are mostly .SWF with scripts that only work in the Flash authoring environment.
I will post the .FLA and everything else needed to get the SWF working also on this blog. But I can’t promise that it will be educational, but I will try to clean up the files where I can.
The Flash Panels can be found under “Window” >> “Other Panels“.

A Flash panel can be installed manually, but you will need a restart before you can use it. But once you installed it and restarted Flash you can modify the SWF as much as you want.

Flash 8

C:\Documents and Settings\[username]\Local Settings\Application Data\Macromedia\Flash 8\[language]\Configuration\WindowSWF

Flash CS3:

C:\Documents and Settings\[username]\Local Settings\Application Data\Adobe\Flash CS3\[language]\Configuration\WindowSWF
Remember to look in the “Local Settings” folder for the “Application Data” folder!
Flash 8 was made by “Macromedia” but this company was bought by Adobe so Flash CS3 can be found in the “Adobe” folder
You need to restart Flash to have access to Flash Panel

Adobe Extension Manager

To install any of the extensions (.MXP – files) I’ve created you will need a Adobe Extension Manager, it’s free and you can install older versions in case you’re working with Flash MX of Flash 8.
And at least Macromedia Flash MX 2004 but I’m working with Adobe Flash CS3 and I test my scripts in Flash 8.

Once you have the Extension Manager installed you only have to download the MXP files and double click it or use the install on the Extension Manager.

Creative Commons License

And, as most of my work here, it’s licensed under Creative Commons License:

Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.

Categories
Flash Flash experiments

Flash experiments: amazing tube

I was experimenting with Google SketchUp 6 and Pepakura designer v2 .1.2.
And I saw in the Pepakura a pattern when creating tubes.

Update: it not only creates tubes (example: 15 sides) but also cubes (4 sides) and prism (3 sides)

And off course I couldn’t resist building it in Flash:

And in this case it’s a flash application that creates flat, printable versions of cubes tube. Just print it, cut it out, glue it together and there you have it: the amazing cube tube:

[swf]http://www.matthijskamstra.nl/laboratory/swf_experiments/amazingTube_v01.swf,450,450[/swf]

I have made something similar: the amazing cube.
I’m working towards something????

Categories
Extending Flash Flash

XML Reader Flash panel

When you’re working with Flash and dynamic content your no stranger to XML.
And how to access the data in the XML.

There are a couple of ways you can access and manipulating XML documents in Flash:

  1. the nerdy way (XML DOM): my_xml.firstChild.childNodes[2].childNodes[1].attributes.x
  2. the xPath way using xfactorstudio XPath classes: xmlDoc.selectNodes("/bookstore/book[price>35]/title")
  3. the Flash XPathAPI class: XPathAPI.selectNodeList(xml.firstChild, "/rdf:RDF/item/title")
  4. the XML2Array methode: Novel[0].Description[0].value

Before I discovered option 2 /3 /4, I had to work with XML DOM. This was also in the periode I was still programming in the Flash IDE and the XML DOM methode cost me a lot of time: I couldn’t find the correct node, or attribute, etc.

Until I started programming in SE|PY, because it has a XML Reader. The XML Reader could check if my XML was correctly formatted, and I could just point to the node I wanted to use and it gave me the correct node path.
I don’t know when it started (probably for a while, because I started to use different methodes to access XML) but sadly this reader has some errors, which makes it difficult to use.

But why do I care? I needed to use the XML DOM because I didn’t want to add to the kb of a dynamic banner I was building. It was programmed it in Flash IDE and the SE|PY XML Reader didn’t work….

Download:

Without more blabla: here is the first version of XML Reader.

XML Reader Flash panel XML_Reader_v0.1.zip (52kB)

In the zip is also a readme.txt with more info about XML Reader.
Doubts? Test drive it here!
Let me know what you think of it, what’s wrong with it, what could improve, bugs, etc

Description XML Reader

XML Reader is a Flash window panel where you can load XML files into.
This is useful in situations when you are writing an XML parser, and need to view the XML your parsing, but don’t feel like toggling back and forth between Flash and another program.
As a Flash panel, you can simply dock it inside of Flash with your other panels, and have it always available while you code in the Flash IDE.

This XML Reader does more: it has color syntax highlighting, indentation and XML DOM(*) to access and manipulate XML Documents WYSIWYG style.

I hope this will help to increase my productivity, and perhaps yours?

(*) The XML Document Object Model (XML DOM) defines a standard way for accessing and manipulating XML documents.

View XML Reader

So I created XML Reader, based upon the one in SE|PY

Because the open XML button only works in Flash a example XML is loaded.

Thanx to:

This project is based upon some work of other developers:

  • The XMLHighlighter class developed by R.Arul Kumaran (at the moment of writing this post I couldn’t visit his site).
    This class is used for highlighting the XML file and my modification makes it possible to ‘trace’ the XML-nodes.
  • The XML and Text Viewer Panel developed by Jesse Randall Warden. This example showed me how to build a panel.
  • The MXI File Creator by Muzakdeezign. This free program is used to create and edit the Macromedia Extension (.mxi file).
  • The XML reader from SE|PY by Alessandro Crugnola.
    This is my free code editor when I’m not using the Flash IDE editor. And the only (as far as I know) wysiwyg XML Reader. Sadly this reader has some errors, which makes it difficult to use. So to fix this, I wrote this panel.
Categories
Flash Flash experiments

Flash experiments: omtrek cirkel

I have to do this in Dutch because I have no idea what’s it called in English, sorry.
It not really important, and will be used in a project which has little to do with this explanation.

Een klein testje om de omtrek en de oppervlakte van een cirkel te berekenen.
Het moest van ver komen dus heb ik het ff opgezocht:
wiswijzer.nl
wisfaq.nl

Omtrek = pi * diameter = 2 * pi * straal
Oppervlakte = 1/4 * pi * diameter2 = pi * straal2

[swf]http://www.matthijskamstra.nl/laboratory/swf_experiments/omtrek.swf, 450, 250[/swf]
Update #1: For my English readers:
(more about circles here)
“omtrek” = circumference
“oppervlakte” = area (read more: circle area)
“diameter” = diameter (diameter)
“straal” = radius
(look more math stuff up at at Math Open Reference)
Categories
Flash Flash experiments

Flash experiments: tiled background

Update #1: Recently there are some who like to have the source of this project, that’s not a problem. But the source is what it is, and there are no comment in the code….
And because this post was not up-to-date, I’ve remove some of the links to sites with patterns because they didn’t exist anymore. That’s also the reason that I had to update the Flash file.
shortcut to download

Another experiment, to use external images for background patterns.

But there was no need to start from zero, so here are some tutorials that I used:

both tutorials were used in the experiment.

[swf]http://www.matthijskamstra.nl/laboratory/swf_experiments/tiledBackground_v02.swf, 450, 450[/swf]

(I had to update this file because of broken links: this is version 2)

Get the source files here:

The .ZIP file contains:

+ tiledBackground     
     + deploy
            - AC_RunActiveContent.js
            - tiledBackground_v02.html
            - tiledBackground_v02.swf
     + source
            - tiledBackground_v02.fla

Borrowed some seamless background pattern from Squidfingers
pattern_021.gif
pattern_095.gif
pattern_111.gif
pattern_131.gif
pattern_141.gif

It’s not possible to link directly to Squidfingers!

But you can find your own patterns on the internet, examples of site with seamless background patterns:
http://www.wonderbackgrounds.com/
http://www.cameradio.tk/tiles1.htm

root2art.co.uk
http://backgroundsarchive.com/tiles/wood.php?page=2

I used http://www.neopets.com/backgrounds_tiled.phtml in the flash source.
But you can use any image from the internet!
(Need some help: find “tiled background” with google )

Categories
Flash Flash experiments

Flash experiments: select

Update: Before I could publish this post, before I finished this experiment, I found a better class to do what I want. TransformManager Released – Scale/Rotate/Move any MovieClip from Jack Doyle (Greensock). This class is what I had in mind when I started…. and much, much more… I’m using this class in the future.

Another experiment: I needed a possibility to select and manipulate a graphic in Flash.
So I looked at illustrator and Flash how they did it, and made a variation of my own.

So for now, I can select the top graphic, move and rotate it (not yet resize…)

Check it here:

[swf]http://www.matthijskamstra.nl/laboratory/swf_experiments/select_v01.swf, 450, 450[/swf]

Or check it the select experiment full screen..

Categories
Flash Flash experiments

Flash experiments: tools

I decided to “share” my unstructured flash experiments:

And in this case it’s a flash application that creates flat, printable versions of cubes. Just print it, cut it out, glue it together and there you have it: the amazing cube:

Or just check tools menu full screen..

Based upon xml: toolsmenu.xml