AS3 required?

i’ve been working with flash all day and i can’t see straight trying to figure all this out. (i’ve been on here all day asking dumb questions too, sorry about that)

please tell me there is an easier way to build something in flash without knowing every line of as3?! what am i missing?

That depends on what you’re building. But more literally, yes. In fact I think you’d be hard to find anything out there in the world that uses every “line” of AS3.

i’m making a company website with a bunch of interactivity and animations within it. the company wants it to be “flash-y” with things moving and changing on the site. (i’ve tried to convince them otherwise).

i’ve tried 3000 ways to make a button work with CS3 and none of them have worked, theres always a different problem. sorry, but flash gets me so frustrated. why can’t there just be a button that says like “link=frame3” … drives me crazy.

Maybe you should look into using the behaviors panel. That is used to make scripting easier (it basically writes out the necessary ActionScript for you). I never use it so I don’t know if it’s AS3 compatible - might only be AS2, but worth looking into. Otherwise you’ll need to learn some ActionScript. And that’s what this site is for. There are plenty of tutorials here (and within Flash help) to get you started. For specific problems you can ask the forum.

for a button that goes to frame 3, in the timeline you would use

buttonsInstanceName.addEventListener(MouseEvent.CLICK, myButtonClickHandler);
function myButtonClickHandler(event:MouseEvent):void {
    gotoAndStop(3);
}

It may be more complex than link=frame3, but there’s a lot more flexibility and functionality. And of course, if you wanted to, you could design your own button to work like that if you so pleased.

haha, when i can get buttons to work, i’ll think about creating my own. you’ll definitely see me on here more often :slight_smile:

thank you for being so helpful today. i really appreciate it.

Forgive me if this seems condescending, but you sound pretty desperate.

[U]Advice number 1:[/U]
Just build the website structure with movieclips in the same way you would build a Photoshop document with pixels on layers.

“Movieclips” are simply display object containers that have their own timeline.
Movieclips are used as “containers” or “wrappers” for bitmaps, shapes created using the Flash drawing tools, text fields, other movieclips, etc…
They are the basis for the vast majority of the assets you’re likely use in a Flash movie.
[INDENT]BTW, The other symbols, “Button” and Graphic" are so seldom used, that they can be safely ignored until your skill level has advanced enough to know when to use them, if at all.[/INDENT]

[INDENT]For example:[/INDENT]
[LIST=1]
[]Create a rectangle shape;
[
]Press F8;
[]In the resulting convert to Symbol dialog, choose “Movie clip” radio button and name the movieclip so you can find it in the library panel;
[
]Click OK to close the dialog;
You now have a movieclip container with your rectangle inside;
[*]Give this movieclip container an instance name in the properties palette;
This is the string that Actionscript 3.0 will use to modify its properties.
“camelCase_mc” is a common format for movieclip instance names. (hence “_mc” suffix which can allow Flash to give you code hints relevant to the Movieclip class while you’re scripting)
[/LIST]

You will repeat this basic process for every visual object on the stage, until you have the complete visual structure for your website assembled.

BTW: you can duplicate an object within the library to quickly create a new independent object that matches the original, but does not share it’s nested assets.
Or you can duplicate an object on the stage, and it will share any nested objects with the original.
ie:
If you make 10 duplicates of a button movieclip on-stage, then change the color of the nested shape in one of the duplicates, the color will change for ALL of the duplicates.
If you make 10 duplicates of a symbol in the library, changing the color of the nested shape for one of them will not affect the duplicates.
This is a fundamental concept for authoring graphics in Flash.

[U]Advice number 2:[/U]
Purchase a book on Actionscript 3.0; ignore books on Flash; they will not help you as much as the knowledge of Actionscript will.
“Learning ActionScript 3.0” by Shupe and Rosser, is an excellent book for beginners.
“Essential ActionScript 3.0” by Moock is a more advanced book for intermediate - advanced Flash programming.

[U]Advice number 3:[/U]
Install [COLOR=“Blue”]TweenMax[/COLOR] right away, and learn how to use it.
It’s free and absolutely awesome.

Here’s an AS3 script to start with.
It’s the constructor for a basic website with three buttons and three cooresponding pages.
It utilizes TweenMax, and illustrates a few basic Flash scripting concepts.
Example site: [COLOR=“Blue”]http://www.byrographics.com/AS3/TweenMaxNav/TweenMaxNav.html[/COLOR]
If you can gain an understanding of how this script works and how to add more content and buttons to it the project, you’ll have less problem learning more advanced techniques.

GL

stop();
import gs.TweenMax;
import fl.motion.easing.*;

/*------------------------------------------------------------------------------------------------------------
fla setup instructions:
this script goes on frame1, layer "actions"
"pageGroup" is movieclip wrapper for movieclips "page1" "page2" "page3" - frame1, layer "pageGroup"
"buttonGroup" is movieclip wrapper for movieclip buttons "btn1" "btn2" "btn3" - frame1, layer "buttonGroup"
frame-based naviagation is not necessary for this setup
------------------------------------------------------------------------------------------------------------*/
buttonGroup.mouseEnabled = false;
buttonGroup.buttonMode = true;
buttonGroup.addEventListener(MouseEvent.MOUSE_OVER, action, false, 0, true);
buttonGroup.addEventListener(MouseEvent.MOUSE_OUT, action, false, 0, true);
buttonGroup.addEventListener(MouseEvent.CLICK, action, false, 0, true);

var pageArray:Array = [pageGroup.page1, pageGroup.page2, pageGroup.page3];
TweenMax.allTo(pageArray, 0, {autoAlpha:0, onCompleteAll:loadHome, overwrite:false});

function loadHome():void {
	TweenMax.to(pageGroup.page1, .4, {delay:.4, autoAlpha:1});
}

var button:String = "";

function action(event:MouseEvent):void {
	button = event.target.name;
	switch (event.type) {
		case MouseEvent.MOUSE_OVER :
			TweenMax.to(event.target, .8, {scaleX:1.3, scaleY:1.3, ease:Elastic.easeOut});
			break;
		case MouseEvent.MOUSE_OUT :
			TweenMax.to(event.target, .8, {scaleX:1, scaleY:1, ease:Cubic.easeOut});
			break;
		case MouseEvent.CLICK :
			TweenMax.to(event.target, .4, {scaleX:1, scaleY:1, ease:Cubic.easeOut});
			TweenMax.allTo(pageArray, .4, {autoAlpha:0, overwrite:false});
			switch (button) {
				case "btn1" :
					TweenMax.to(pageGroup.page1, .4, {delay:.4, autoAlpha:1});
					break;
				case "btn2" :
					TweenMax.to(pageGroup.page2, .4, {delay:.4, autoAlpha:1});
					break;
				case "btn3" :
					TweenMax.to(pageGroup.page3, .4, {delay:.4, autoAlpha:1});
					break;
			}
			break;
	}
}

ha, i am desperate. thanks a lot.

and you’ll be happy to know my buttons work :slight_smile: on to the next… scrolling text boxes :confused:

This is the scroller from gotoandlearn.com
I added an external text loader and TweenMax for easing to it, but otherwise it is essentially the tutorial verbatim.
Example site:[COLOR=“Blue”]http://www.byrographics.com/AS3/textScroller/scrollingText.html[/COLOR]

import gs.TweenMax;
import fl.motion.easing.*;

stage.scaleMode = StageScaleMode.NO_SCALE;

function loadText():void {
	var txtLoader:URLLoader = new URLLoader();
	txtLoader.addEventListener(Event.COMPLETE, onLoaded);
	content.autoSize = TextFieldAutoSize.LEFT;
	txtLoader.load(new URLRequest("pharetra.txt"));
	removeEventListener(Event.COMPLETE, onLoaded);

	function onLoaded(e:Event):void {
		content.text = txtLoader.data;
		if (content.height < sb.track.height) {
			sb.alpha = 0;
		} else if (content.height > sb.track.height) {
			sb.alpha = 1;
			sb.thumb.y = yMin;
			content.y = masker.y;
		}
	}
}

loadText();

var yOffset:Number;
var yMin:Number = 0;
var yMax:Number = sb.track.height - sb.thumb.height;

sb.thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbDown);
stage.addEventListener(MouseEvent.MOUSE_UP, thumbUp);

function thumbDown(e:MouseEvent):void {
	stage.addEventListener(MouseEvent.MOUSE_MOVE, thumbMove);
	yOffset = mouseY - sb.thumb.y;
}

function thumbUp(e:MouseEvent):void {
	stage.removeEventListener(MouseEvent.MOUSE_MOVE, thumbMove);
}

function thumbMove(e:MouseEvent):void {
	sb.thumb.y = mouseY - yOffset;
	if (sb.thumb.y <= yMin) {
		sb.thumb.y = yMin;
	}
	if (sb.thumb.y >= yMax) {
		sb.thumb.y = yMax;
	}
	var sp:Number = sb.thumb.y / yMax;
	TweenMax.to(content, 1, {y:(-sp*(content.height - masker.height)), ease:Back.easeOut});
	e.updateAfterEvent();
}