RE: [Flashcoders] Composition problems

2006-06-16 Thread Merrill, Jason
Given the way you wote the questions class, then:

//file: puzzle.as

import questions;

class Puzzle {
private var QA:questions;
function Puzzle() {
QA = new questions();
trace(QA.qa[0][q])
}
}



Jason Merrill
Bank of America 
Learning Technology Solutions
 
 
 
 
 
 

-Original Message-
From: [EMAIL PROTECTED] [mailto:flashcoders-
[EMAIL PROTECTED] On Behalf Of Mendelsohn, Michael
Sent: Friday, June 16, 2006 4:40 PM
To: Flashcoders mailing list
Subject: [Flashcoders] Composition problems

Hi list...

I'm trying to figure out what I'm missing in trying to instance a
class
via composition:
I have 2 external classes: questions and puzzle.

class questions {
  public var qa:Object = new Object();
  function questions() {
  qa[0] = new Object();
  qa[0][q] = Who will win?;
  qa[0][a] = new Object();
  qa[0][a][0] = Dallas;
  qa[0][a][1] = Miami;
  qa[0][correct] = 1;
  }
}

...and in the puzzle class:
How do you assign a variable so that the entire questions class is
returned?
I've tried the following, none are working.

class puzzle {
  private var QA:questions;
  function puzzle() {
  QA = new questions();
  }
}

class puzzle {
  function puzzle() {
  private var QA = new questions();
  }
}


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Composition problems

2006-06-16 Thread Merrill, Jason
Another things, a lot of people also capitalize class names, but that's
personal preference.  And if you aren't already, would recommend you
organize your classes into packages - will get real messy real quick if
you don't.  

Jason Merrill
Bank of America 
Learning Technology Solutions
 
 
 
 
 
 

-Original Message-
From: [EMAIL PROTECTED] [mailto:flashcoders-
[EMAIL PROTECTED] On Behalf Of Merrill, Jason
Sent: Friday, June 16, 2006 4:48 PM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] Composition problems

Given the way you wote the questions class, then:

//file: puzzle.as

import questions;

class Puzzle {
  private var QA:questions;
  function Puzzle() {
  QA = new questions();
  trace(QA.qa[0][q])
  }
}



Jason Merrill
Bank of America
Learning Technology Solutions







-Original Message-
From: [EMAIL PROTECTED] [mailto:flashcoders-
[EMAIL PROTECTED] On Behalf Of Mendelsohn, Michael
Sent: Friday, June 16, 2006 4:40 PM
To: Flashcoders mailing list
Subject: [Flashcoders] Composition problems

Hi list...

I'm trying to figure out what I'm missing in trying to instance a
class
via composition:
I have 2 external classes: questions and puzzle.

class questions {
public var qa:Object = new Object();
function questions() {
qa[0] = new Object();
qa[0][q] = Who will win?;
qa[0][a] = new Object();
qa[0][a][0] = Dallas;
qa[0][a][1] = Miami;
qa[0][correct] = 1;
}
}

...and in the puzzle class:
How do you assign a variable so that the entire questions class is
returned?
I've tried the following, none are working.

class puzzle {
private var QA:questions;
function puzzle() {
QA = new questions();
}
}

class puzzle {
function puzzle() {
private var QA = new questions();
}
}


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Composition problems

2006-06-16 Thread Mendelsohn, Michael
Thanks Jason.  I figured it out.  I was getting tripped up by the fact
that how I was doing it was only returning functions, not properties.

In my fixed puzzle class:

private function defineQuestions():Void {
// create the  question and answer data object...
var QA = new questions();
theQuestions = QA.getQuestions();
}

In the questions class, getQuestions returns the built object.

But, I like your way better.  :-)  And, I'll put them in a package,
thanks.

- MM


--  


Given the way you wote the questions class, then:

//file: puzzle.as

import questions;

class Puzzle {
private var QA:questions;
function Puzzle() {
QA = new questions();
trace(QA.qa[0][q])
}
}

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Composition problems

2006-06-16 Thread Merrill, Jason
Actually, using a Getter() method is often preferable too - just depends
on how you want to do it.

I will say, I would keep your Questions class as a generic Model class
- as abstract as possible - and keep the questions external - say in XML
or a webservice of some kind- and pass the data to the Questions model
class.  I wouldn't hard code the data in the class itself.  Classes
should contain no information is a good way to think of it.

Jason Merrill
Bank of America 
Learning Technology Solutions
 
 
 
 
 
 

-Original Message-
From: [EMAIL PROTECTED] [mailto:flashcoders-
[EMAIL PROTECTED] On Behalf Of Mendelsohn, Michael
Sent: Friday, June 16, 2006 4:56 PM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] Composition problems

Thanks Jason.  I figured it out.  I was getting tripped up by the fact
that how I was doing it was only returning functions, not properties.

In my fixed puzzle class:

  private function defineQuestions():Void {
  // create the  question and answer data object...
  var QA = new questions();
  theQuestions = QA.getQuestions();
  }

In the questions class, getQuestions returns the built object.

But, I like your way better.  :-)  And, I'll put them in a package,
thanks.

- MM


--


Given the way you wote the questions class, then:

//file: puzzle.as

import questions;

class Puzzle {
  private var QA:questions;
  function Puzzle() {
  QA = new questions();
  trace(QA.qa[0][q])
  }
}

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Composition problems

2006-06-16 Thread Bernard Visscher
 Another things, a lot of people also capitalize class names, 
 but that's personal preference.  And if you aren't already, 
 would recommend you organize your classes into packages - 
 will get real messy real quick if you don't.  

And if you do create packages as Jason proposed..
My personal preference is to create package names lowercase and begin the
classname with a Capital...
That way it's easy to read (I think..)

My 2 cents

Bernard

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com