Welcome, Guest. Please login or register.
Did you miss your activation email?
05/21/12, 03:23
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  The Library
| |-+  Technical Reference Area (Moderators: Flash-db, Musicman, BurtonRider1983, vesa kortelainen, Ronald Wernecke, Jorge Solis)
| | |-+  MINI tutorial - Visual Respons At Authoring
0 Members and 2 Guests are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: MINI tutorial - Visual Respons At Authoring  (Read 3159 times)
Mattias Robo
Mods
Systems Administrator
*****
Posts: 555



View Profile WWW
« on: 02/23/05, 12:28 »


Ok. I like to take the liberty of doing a little tutorial since I've been struggeling with this problem for a while and finally came up with a satisfying solution.

This is a turorial for people who would like to be able to set parameters of their movieclips and also being able to see changes directly when working with the fla. BUT who doesn't have a clue of how you make your own components. Cause we're not going to make real components, only add the least code necessary to make things work.

It's about two features really. Component Definitions and Live Preview.

1> Component Defenition

Let's say we have a MC on stage called ballHolder. Inside it is another MC called ball and a dynamic textfield called txt_name.

Now. Rightclick the ballHolder in the library and choose component definitions. Then add maybe two parameters. Set one to string and the other to color.
Give them a description and a variable name, in this case nameOfBall and ballColor. Set any defaultvalue you like. OK.

Now you can change these parameters in the property inspector.
They are accessable directly from within the ballHolder like:
[script]
txt_name.text = nameOfBall

myColor = new Color(ball)
myColor.setRGB(ballColor)
[/script]


2> Live preview

Now this is a really nice feature of MX 2004. Don't remember if it's included in MX but wouldn't think so.
Anyhew.

What you do is to make an swf that is used for a preview inside you MC. Weird huh? But really cool.
We can use the same ball.

Open a new fla and give it the size of the ball and copy the content of the ballHolder mc into this fla.
I.e. you can consider the Live Preview fla being the ballHolder.

Now. The trick is a function called onUpdate. And to get hold of the variables set on the ballHolder in the original file you get it from xch.
I have no idea why you have to write xch but it works! Smiley

On the maintimeline of the Live Preview fla write:
[script]
function onUpdate(){
txt_name = xch.nameOfBall
myColor = new Color(ball)
myColor.setRGB(xch.ballColor)
}[/script]

As you've probably figured out you can do whatever you like with this Live preview file. Just keep in mind that the onUpdate function is what make things happen.


Export the movie.

Back to the original fla.

Rightclick the ballHolder in the library and choose Component Definitions.
Point to your Live Preview file and voila! ..at least I hope.

Now you should be able to see the name and color change as you change the parameters.


:: robot

« Last Edit: 02/24/05, 05:30 by Mattias Robo » Logged

     "I've figured it out. It's not the fords... it's what's IN them!.."
Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!