Archive for the topic 'Flash'

Organic flash tree

Tuesday, September 13th, 2005

Nice organic growth produced using actionscript:

It uses the following actionscript:

1. Set:

rand = "70";

2. In a MovieClip (number of frames = time it takes to grow the tree.)
Frame 1 - Set:

i="0"

3. Frame 2 - Apply the following to a (white / invisible) small, tapering, vertical trunk shaped shape.

if (Number(x)<50) {
x = Number(x)+.2;
y = Number(y)+.2;
setProperty("", _xscale, x);
setProperty("", _yscale, y);
} 

3. Repeat. i.e.:

Frame 3:

gotoAndPlay (2)

Pop-up Flash Navigation Menu

Friday, August 26th, 2005

Is there an instance where anyone would want to have a navigation menu in a browser window separate to the main content window? Probably not - it’s invariable better to keep the menu with the content.

Advantages would arise if someone couldn’t use PHP and didn’t want to repeat their navigation menu in every page (making changes a lot of work) or if the design necessitated the content takes up 100% of each page.

Anyway I worked out how it’s done before deciding it was a bad idea so here’s the code:

Basic linking to the parent window from flash in a pop-up (child) window

1. Create pop-up window.

First you have to create a page for the pop-up window. (pop-up-window.html in this example): Then from the main page you make the menu window spawn automatically or create a ‘menu button’ to bring up the menu using JavaScript.

This can be done from flash if the main window is pure flash with the Get URL action:

on (release) {
getURL ("javascript:NewWindow=window.open
('popupwindow.html','newWin',
'width=550,height=400,left=0,top=0,toolbar=No,location=No,
scrollbars=No,status=Yes,resizable=No,fullscreen=No');
NewWindow.focus(); void(0);");
}

More options are given by Jeffery Hill at:
http://www.flashkit.com/tutorials/Jeffery…

2. Linking between the pop-up window and your main Parent page.

Use this javascript code in (the of) your pop-up window:

function updateParent(newURL) {
opener.document.location = newURL
}

3. Add the action to the button in your flash menu.

Create an instance of a button using Insert - >New symbol. (You’ll need a new button for every page in the website so for a large site use any of the flash menus available to make a better system.)
Add the following address as part of a getURL action to your flash button:

"javascript:updateParent('page2.html')"

i.e. - Select the button in flash and add the actionscript in the actions box:

on(release) {
getURL("javascript:updateParent('nextpage.html')");
}

note: page2.html is the html page that will appear in your parent window (or target frame)

4. That’s it, although I recommend changing the focus back to your main window - i.e. The parent window comes to the forefront after the page is changed.

Use this javascript code in (the of) your pop-up window:

function updateParent(newURL) {
opener.document.location = newURL;
timoutID=setTimeout("focusMain()",100)
}
function focusMain(){
opener.document.focus();
clearTimeout(timeoutID)
}

note: If you’re using frames in your document the ‘Parent’ page is the frame which spawned the pop-up window.

5. That really is it, although I recommend having a cup of tea now.

Cats Scratch

Saturday, August 13th, 2005

cat buttonsIt’s possible to create a flash movie where the movement of the cursor moves the frame forward or backward:

To do this you create a movie. In the movie add your movieclip and in the same frame add the following actionscript:

stop();
_root.onMouseMove = function() {
moveForward.gotoAndStop(Math.ceil(_xmouse/5));
}

The movie width and the number of frames in the movieClip affects the action. In this example the movie is 250px wide and the movieClip has 50 frames.
Math.ceil(_xmouse/5) makes the movie move 5 frames for every pixel the cursor moves.

Lastly, every frame in the movieClip should have the action stop();