Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> How Do I, define variables in flash
Mononoko
post Jul 7 2007, 02:09 PM
Post #1


Newbie [Level 1]
*

Group: Members
Posts: 12
Joined: 5-July 07
Member No.: 46,006



were doing a course in ICT called multimedia, but i dont know how to define variables
and whenever i ask my teacher he always goes
"were not that far yet"

he doesn't even look at what i have done, assumes I'm not finished, when i am, the only thing i need now is a scoring system
Go to the top of the page
 
+Quote Post
shadowx
post Jul 7 2007, 03:05 PM
Post #2


A clever man learns from his own mistakes, a WISE man learns from those of OTHERS
***********

Group: [HOSTED]
Posts: 1,035
Joined: 12-April 06
From: Essex, UK
Member No.: 21,719



What language are you using? i would assume its visual basic, AKA "VB", if so the usual way to do this is with code like this:

CODE
Dim VariableName As Type

EG:

Dim Score As Integer

And then to assign a value:

Score = "1"


That probably isnt completely right but it will give you an idea, i, sure the first part, "Dim.." is fine but as for the secnd im not so sure, i dont use VB much. If its anther language let us know and someone can help smile.gif

I remember doing multimedia at college... it was dreadful...
Go to the top of the page
 
+Quote Post
Tetraca
post Jul 7 2007, 05:19 PM
Post #3


Privileged Member
*********

Group: Members
Posts: 628
Joined: 20-May 06
Member No.: 23,968



QUOTE(Mononoko @ Jul 7 2007, 02:09 PM) *
were doing a course in ICT called multimedia, but i dont know how to define variables
and whenever i ask my teacher he always goes
"were not that far yet"

he doesn't even look at what i have done, assumes I'm not finished, when i am, the only thing i need now is a scoring system

I'm guessing C++ is the language you are using.
CODE
type name;

Where type is the type of variable. Where name is the name of the variable. The type can be int for integers, float for real numbers, char for characters(it will only store one character if it isn't an array or pointer), and a host of various other types that you might not find useful under normal circumstances at this point. This is the basic way to declare variables in any C-like language(Java, C, C++, mainly) but PHP, and Perl which don't require variables to be defined.

To assign a variable a value:
CODE
name = value;


Remember to put these in your functions like main() or it will be a global variable. Global variables are frowned upon in C.


This post has been edited by Tetraca: Jul 7 2007, 05:20 PM
Go to the top of the page
 
+Quote Post
galexcd
post Jul 7 2007, 10:02 PM
Post #4


Define:EVIL PROGRAMMER (ē'vəl prō'grăm'ər)- n. An organism that converts caffeine into evil software.
***********

Group: [HOSTED]
Posts: 1,076
Joined: 25-September 05
From: Los Angeles, California
Member No.: 12,251



In the description of the topic is what language he is talking about: "define variables in flash". So I'm guessing you mean actionscript. Now most programing languages are very similar when defining variables. Flash isn't as strict as c++ is so you do not need to put the type of variable when declaring it. To declare a variable in flash all you need to write is
CODE
var variablename;


After the variable is defined, you can then set it the same way you do it as shown above in both c++ and vb (and also pretty much every other language).
CODE
variablename=value;


Value can either be another variable, a string (text, which must be surrounded in quotations ex: variablename="text";), or a number (there are many different value types for holding numbers, when you assign a number to a variable in flash it automatically assigns the variable to the correct type so you do not need to worry about it).

I assume your class will go over this shortly along with all of the different variable types.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. How To: Flash Streaming(4)
  2. Photoshop, Flash And Fireworks Tutorial Site Links(2)
  3. Flash Tutorial Simple Motion Tween(0)
  4. Flash Video Recorder(2)


 



- Lo-Fi Version Time is now: 8th October 2008 - 11:13 AM