Adobe Dreamweaver Forums



Last 10 THreads :         Broken Links after import (Last Post : HydroModeler - Replies : 0 - Views : 1 )           »          Quiz communication to SumTotal LMS (Last Post : roxlwood - Replies : 3 - Views : 6 )           »          How to turn IMAGE into MOVIECLIP??? (Last Post : Amy Blankenship - Replies : 5 - Views : 6 )           »          Making a photo with rounded corners (Last Post : Linda Rathgeber - Replies : 1 - Views : 2 )           »          Editing spry menu in Contribute (Last Post : ThinkInk - Replies : 2 - Views : 13 )           »          Online shop with barcode scanner (Last Post : Ullitasch - Replies : 0 - Views : 1 )           »          DIV in Table not working. (Last Post : Murray *ACE* - Replies : 5 - Views : 6 )           »          Dreamweaver CS3 Problem on Windows Vista (Last Post : Murray *ACE* - Replies : 15 - Views : 16 )           »          Results from form not coming up (Last Post : Gary White - Replies : 6 - Views : 7 )           »          uploading site (Last Post : Murray *ACE* - Replies : 12 - Views : 13 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Other Macromedia/Adobe Products > Flex
 
Tags:



Reply
  #1 (permalink)  
Old 10-01-2008, 02:59 PM
BudHud
 
Posts: n/a
Diggs:
Default Returning text from class to project file

I want to return more than one string result from a class file to a project
file.

Examples below:

THE CLASS FILE:

public function sayHello():String
{
result = "This is the first idea I have. ";
return result;
}

THE PROGRAM FILE:

private function initApp():void
{
var myTexter:Texter = new Texter;

output1.text = myTexter.sayHello();

This works fine into output1.text.

How can I use the class function sayHello() to return a second result, this
time into output2.text within the initApp project function?

}

Thanks,

BH



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 10-01-2008, 02:59 PM
theLoggerGuy
 
Posts: n/a
Diggs:
Default Re: Returning text from class to project file

The simple answer is: you can't. Not very useful to you though. After
thinking about it for a while I find that there is a surprisingly high number
of ways to answer this, but I'll pick one (and it's not great).

In your class your function sayHello() does only one thing. It should
stay that way. If you want to return something else then write another
function: eg., sayGoodbye(). However, if you're hell-bent on returning
more than one thing from a function then just return an array (or better yet a
custom data object).

eg Class:
public function sayManyGreetings( ): Array
{
return [ "Hello", "Bonjour", "Guten tag", "G'Day" ];
}

Main:
private function initApp():void
{
var myTexter: Texter = new Texter;

output1.text = myTexter.sayManyGreetings[ 0 ];
output2.text = myTexter.sayManyGreetings[ 1 ];
}

Reply With Quote
  #3 (permalink)  
Old 10-01-2008, 02:59 PM
theLoggerGuy
 
Posts: n/a
Diggs:
Default Re: Returning text from class to project file

The simple answer is: you can't. Not very useful to you though. After
thinking about it for a while I find that there is a surprisingly high number
of ways to answer this, but I'll pick one (and it's not great).

In your class your function sayHello() does only one thing. It should
stay that way. If you want to return something else then write another
function: eg., sayGoodbye(). However, if you're hell-bent on returning
more than one thing from a function then just return an array (or better yet a
custom data object).

eg Class:
public function sayManyGreetings( ): Array
{
return [ "Hello", "Bonjour", "Guten tag", "G'Day" ];
}

Main:
private function initApp():void
{
var myTexter: Texter = new Texter;

output1.text = myTexter.sayManyGreetings[ 0 ];
output2.text = myTexter.sayManyGreetings[ 1 ];
}

Reply With Quote


  #4 (permalink)  
Old 10-01-2008, 02:59 PM
theLoggerGuy
 
Posts: n/a
Diggs:
Default Re: Returning text from class to project file

The simple answer is: you can't. Not very useful to you though. After
thinking about it for a while I find that there is a surprisingly high number
of ways to answer this, but I'll pick one (and it's not great).

In your class your function sayHello() does only one thing. It should
stay that way. If you want to return something else then write another
function: eg., sayGoodbye(). However, if you're hell-bent on returning
more than one thing from a function then just return an array (or better yet a
custom data object).

eg Class:
public function sayManyGreetings( ): Array
{
return [ "Hello", "Bonjour", "Guten tag", "G'Day" ];
}

Main:
private function initApp():void
{
var myTexter: Texter = new Texter;

output1.text = myTexter.sayManyGreetings[ 0 ];
output2.text = myTexter.sayManyGreetings[ 1 ];
}

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 09:49 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Cheap Car Insurance - Compare Motor Insurance
Endsleigh Car Insurance Natwest Car Insurance
More Than Car Insurance Norwich Union Car Insurance
Prudential Car Insurance Zurich Car Insurance
Inactive Reminders By Mished.co.uk