Re: [Flashcoders] My first code.

2010-12-20 Thread spyder spyders
Thank you both.  i can see where I know parts but not the big picture. 
Unfortunately, right now Im strapped for cash.  Here is how I made and used the 
class.  I didnt know to link it as a base class.  I linked it as a "Class."  
But, it works as far as I can tell!!!  : )  It is going to need to do turn 
something on and off at some point, but I think you will get the general idea.

Thanks everyone!!  :D

I tried to mail it and it was too big.  0.89mb I think

http://rapidshare.com/files/438465414/firstToggleButton.zip
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] My first code.

2010-12-19 Thread Cor
@Q 1:

You don't use the ToggleButton class to create the instances in that way,
the class handles the properties and methods.
And in your main (document) class or on the timeline in AS you set:

private var toggleButton1:ToggleButton = new ToggleButton();
private var toggleButton2:ToggleButton = new ToggleButton();


HTH,
Cor van Dooren


-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of John
McCormack
Sent: zondag 19 december 2010 12:51
To: Flash Coders List
Subject: Re: [Flashcoders] My first code.

On 15/12/2010 23:53, spyder spyders wrote:
>I am trying to write a ToggleButton Class.I can get it to work as a
document class and as as3 on timeline.  But how to I use it as a symbol
class?

Q. "I am guessing that the 'this'  is pointing to the symbol or _mc I 
attach the class to?"

Not attach, but define. The class defines the object and 'this' refers 
to the one (instance) being accessed:

Let's say you use the ToggleButton class to create two instances:

public var toggleButton1:MovieClip; // **
public var toggleButton2:MovieClip;

and somewhere you call someMethod() on toggleButton1...

toggleButton1.someMethod(); // 1
or
toggleButton2.someMethod(); // 2

Then once inside someMethod(),  the reserved variable 'this' would refer 
to operations on toggleButton1 on line 1 and toggleButton2 on line 2.


Q. "But how to I use it as a symbol class?"

Let's say it's not the document class. Save the file ToggleButton.as. In 
your new code create a new symbol called ToggleButton for the library 
and in its properties you name the file ToggleButton.as

Any code after that can just declare it as in ** and use it as in 1 and 2.

Those books will be a big help.

John


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1170 / Virus Database: 426/3320 - Release Date: 12/16/10

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] My first code.

2010-12-19 Thread Cor
Right-Click object in Library,
Click Linkage
Select Export for Actionscript
Set the ToggleButton as Base class file

Groeten,
Cor van Dooren
www.codobyte.com
--
 "There are only 10 types of people in the world:
   Those who understand binary and those who don't."


-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of John
McCormack
Sent: zondag 19 december 2010 12:51
To: Flash Coders List
Subject: Re: [Flashcoders] My first code.

On 15/12/2010 23:53, spyder spyders wrote:
>I am trying to write a ToggleButton Class.I can get it to work as a
document class and as as3 on timeline.  But how to I use it as a symbol
class?

Q. "I am guessing that the 'this'  is pointing to the symbol or _mc I 
attach the class to?"

Not attach, but define. The class defines the object and 'this' refers 
to the one (instance) being accessed:

Let's say you use the ToggleButton class to create two instances:

public var toggleButton1:MovieClip; // **
public var toggleButton2:MovieClip;

and somewhere you call someMethod() on toggleButton1...

toggleButton1.someMethod(); // 1
or
toggleButton2.someMethod(); // 2

Then once inside someMethod(),  the reserved variable 'this' would refer 
to operations on toggleButton1 on line 1 and toggleButton2 on line 2.


Q. "But how to I use it as a symbol class?"

Let's say it's not the document class. Save the file ToggleButton.as. In 
your new code create a new symbol called ToggleButton for the library 
and in its properties you name the file ToggleButton.as

Any code after that can just declare it as in ** and use it as in 1 and 2.

Those books will be a big help.

John


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1170 / Virus Database: 426/3320 - Release Date: 12/16/10

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] My first code.

2010-12-19 Thread John McCormack

On 15/12/2010 23:53, spyder spyders wrote:

   I am trying to write a ToggleButton Class.I can get it to work as a 
document class and as as3 on timeline.  But how to I use it as a symbol class?


Q. "I am guessing that the 'this'  is pointing to the symbol or _mc I 
attach the class to?"


Not attach, but define. The class defines the object and 'this' refers 
to the one (instance) being accessed:


Let's say you use the ToggleButton class to create two instances:

public var toggleButton1:MovieClip; // **
public var toggleButton2:MovieClip;

and somewhere you call someMethod() on toggleButton1...

toggleButton1.someMethod(); // 1
or
toggleButton2.someMethod(); // 2

Then once inside someMethod(),  the reserved variable 'this' would refer 
to operations on toggleButton1 on line 1 and toggleButton2 on line 2.



Q. "But how to I use it as a symbol class?"

Let's say it's not the document class. Save the file ToggleButton.as. In 
your new code create a new symbol called ToggleButton for the library 
and in its properties you name the file ToggleButton.as


Any code after that can just declare it as in ** and use it as in 1 and 2.

Those books will be a big help.

John


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] My first code.

2010-12-16 Thread Kerry Thompson
spyder spyders wrote:


> To be honest I am a music producer that is interested in video game sound
> design.  I needed to make a webpage for myself and found out how Flash is in
> many ways like the music software I use. I love that I can learn coding.
> It is kind of a hobby.


There are a fair number of musicians on the list--people like me who code by
day and play in a band (or a symphony, in my case) by night.

Welcome aboard.

Cordially,

Kerry Thompson
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] My first code.

2010-12-16 Thread spyder spyders
Thanks Paul and M.  I have been reading sites on the internet.  Here  
are a few.


http://active.tutsplus.com/
http://www.kirupa.com/developer/flash/index.htm
Plus there is youtube.
http://www.freebookcentre.net/graphics-design-books/flash-ebooks-download.html
http://www.gaiaflashframework.com/


I know
binary systems
hex
logic gates
arrays
strings
variables
I have been reading about OOP and how it is structured like zoology or  
biology.


Im good with electronics
To be honest I am a music producer that is interested in video game  
sound design.  I needed to make a webpage for myself and found out how  
Flash is in many ways like the music software I use. I love that I can  
learn coding.   It is kind of a hobby.  You guys are great! Very nice  
people, : )


Have a good day.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] My first code.

2010-12-16 Thread Paul Andrews

On 16/12/2010 14:54, Matt S. wrote:

Spyder, you should order Colin Moock's book toute suite:
http://www.amazon.com/exec/obidos/ASIN/0596526946/ref=nosim/moockorg

It's essential reading for anyone interested in learning AS3.


It is, but http://www.learningactionscript3.com/ is a much gentler ride 
to get started.


Paul



.m


On Thu, Dec 16, 2010 at 2:38 AM, spyder spyders  wrote:

Thank You So Much! :DI have been researching for over a 
month!!  I am guessing that the 'this'  is pointing to the symbol or _mc I 
attach the class to?
I ended up doing away with all of the  "this" because I was receiving an error message saying  
"gotoAndStop is not a function."  Also I needed to declare the variable  "buttonState"

Here it is!!! My first Class!
Thank you!

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] My first code.

2010-12-16 Thread Matt S.
Spyder, you should order Colin Moock's book toute suite:
http://www.amazon.com/exec/obidos/ASIN/0596526946/ref=nosim/moockorg

It's essential reading for anyone interested in learning AS3.

.m


On Thu, Dec 16, 2010 at 2:38 AM, spyder spyders  wrote:
> Thank You So Much! :D    I have been researching for over 
> a month!!  I am guessing that the 'this'  is pointing to the symbol or _mc I 
> attach the class to?
> I ended up doing away with all of the  "this" because I was receiving an 
> error message saying  "gotoAndStop is not a function."  Also I needed to 
> declare the variable  "buttonState"
>
> Here it is!!! My first Class!
> Thank you!

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] My first code.

2010-12-16 Thread Paul Andrews

On 16/12/2010 07:38, spyder spyders wrote:

Thank You So Much! :DI have been researching for over a 
month!!  I am guessing that the 'this'  is pointing to the symbol or _mc I 
attach the class to?
I ended up doing away with all of the  "this" because I was receiving an error message saying  
"gotoAndStop is not a function."  Also I needed to declare the variable  "buttonState"


Using "this" shouldn't cause you a problem in a class definition. If you 
don't use it it generally means the same thing as "this."!


"gotoAndStop is not a function." I would associate with a class that did not 
extend MovieClip.


Spend some time on some OO tutorials to try and get the main concepts 
then you'll soon see how it all fits together.



Here it is!!! My first Class!

Excellent.

Thank you!


You're welcome.



###

package
{

import flash.display.MovieClip;
import flash.events.MouseEvent;


public class ToggleButton extends MovieClip
{
//public var togglButton:MovieClip;
public var buttonState = MovieClip;

public function ToggleButton()
{
// constructor code



//event listeners
addEventListener(MouseEvent.MOUSE_OVER, rolloverToggle);
addEventListener(MouseEvent.MOUSE_OUT, rolloutToggle);
addEventListener(MouseEvent.CLICK, toggleClick);
buttonState = "off";


// Respond to mouse events
function rolloverToggle(event:MouseEvent)
{
gotoAndStop(buttonState+" over");

} //rollover f(x)

function rolloutToggle(event:MouseEvent)
{
gotoAndStop(buttonState);

} //rollout f(x)

function toggleClick(event:MouseEvent)
{
if (buttonState == "on")
{
buttonState = "off";
} //if
else
{
buttonState = "on";
} //else
gotoAndStop(buttonState+" over");

} //toggle click f(x)

} //constructor f(x)

} //class

} //package



#
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] My first code.

2010-12-15 Thread spyder spyders
Thank You So Much! :DI have been researching for over a 
month!!  I am guessing that the 'this'  is pointing to the symbol or _mc I 
attach the class to? 
I ended up doing away with all of the  "this" because I was receiving an error 
message saying  "gotoAndStop is not a function."  Also I needed to declare the 
variable  "buttonState"

Here it is!!! My first Class! 
Thank you!



###

package
{

import flash.display.MovieClip;
import flash.events.MouseEvent;


public class ToggleButton extends MovieClip
{
//public var togglButton:MovieClip;
public var buttonState = MovieClip;

public function ToggleButton()
{
// constructor code



//event listeners
addEventListener(MouseEvent.MOUSE_OVER, rolloverToggle);
addEventListener(MouseEvent.MOUSE_OUT, rolloutToggle);
addEventListener(MouseEvent.CLICK, toggleClick);
buttonState = "off";


// Respond to mouse events
function rolloverToggle(event:MouseEvent)
{
gotoAndStop(buttonState+" over");

} //rollover f(x)

function rolloutToggle(event:MouseEvent)
{
gotoAndStop(buttonState);

} //rollout f(x)

function toggleClick(event:MouseEvent)
{
if (buttonState == "on")
{
buttonState = "off";
} //if
else
{
buttonState = "on";
} //else
gotoAndStop(buttonState+" over");

} //toggle click f(x)

} //constructor f(x)

} //class

} //package



#
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] My first code.

2010-12-15 Thread Paul Andrews

On 15/12/2010 23:53, spyder spyders wrote:

   HELLO FlashCoders!

   I am trying to write a ToggleButton Class.I can get it to work as a 
document class and as as3 on timeline.  But how to I use it as a symbol class?


Everywhere you have "toggleButton" replace it with "this" or remove it 
altogether.

In the linkage for the MovieClip that represents the toggle, put this class.

Paul



Thx!
/

package
{

import flash.display.MovieClip;
import flash.events.MouseEvent;


public class ToggleButton extends MovieClip
{
public var toggleButton:MovieClip;

public function ToggleButton()
{
// constructor code



//event listeners
toggleButton.addEventListener(MouseEvent.MOUSE_OVER, 
rolloverToggle);
toggleButton.addEventListener(MouseEvent.MOUSE_OUT, 
rolloutToggle);
toggleButton.addEventListener(MouseEvent.CLICK, 
toggleClick);
toggleButton.buttonState = "off";


// Respond to mouse events
function rolloverToggle(event:MouseEvent)
{
toggleButton.gotoAndStop(toggleButton.buttonState+" 
over");

} //rollover f(x)

function rolloutToggle(event:MouseEvent)
{

toggleButton.gotoAndStop(toggleButton.buttonState);

} //rollout f(x)

function toggleClick(event:MouseEvent)
{
if (toggleButton.buttonState == "on")
{
toggleButton.buttonState = "off";
} //if
else
{
toggleButton.buttonState = "on";
} //else
toggleButton.gotoAndStop(toggleButton.buttonState+" 
over");

} //toggle click f(x)

} //constructor f(x)

} //class

} //package


/
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders