Writing a simple class

I would like to write a class that will draw a gradient for
the whole background of my file. I had written this in my file and
it was working, but I would like to put that code into a class now,
as I am trying to learn how to write classes. I am totally new to
classes, so bare with me, I don't know what I am doing... more
guessing at this point really. Here is what I have so far.
My class is called BgGradient.as and holds the following AS
so far.
class BgGradient
var gradient01:String;
var gradient02:String;
var fillType:String = "linear";
var colors:Array = [gradient01, gradient02];
var alphas:Array = [100, 100];
var ratios:Array = [0, 255];
var matrix:Object = {matrixType:"box", x:0, y:0,
w:Stage.width, h:Stage.height, r:(90/180)*Math.PI};
var spreadMethod:String = "pad";
var interpolationMethod:String = "linearRGB";
var focalPointRatio:Number = 1;
function BgGradient() {
beginGradientFill(fillType, colors, alphas, ratios, matrix,
spreadMethod, interpolationMethod, focalPointRatio);
moveTo(0, 0);
lineTo(Stage.width, 0);
lineTo(Stage.width, Stage.height);
lineTo(0, Stage.height);
lineTo(0, 0);
endFill();
I would like gradient01 and gradient02 to be hex values that
I can specify in my main file. What am I missing here? Do I need to
import anything? How about the drawing API? How would I call this
from my main file?
Thanks a lot for any help with this. I really appreciate any
help!

you don't have to pass anything, except you must pass
something that has can reference a graphics class member to which
you can apply your begingradientfill method.
but if you want to specify gradient01 and gradient02 from
outside your class, that would be one way to do it. you could also
use a setter to define those variables outside your constructor.
which is best depends upon what you want to do. if you always
know those variable values when your create a class member, pass
them in the contructor. otherwise, a setter is a good way to
go.

Similar Messages

  • What is wrong with my simple class program?

    Ok, I'm writing a simple class called 'Frog', which will keep track of the position enter by a user. The program will ask for the initial position for the frog. It will then ask for how many steps it want the frog to jump. Then it will output the new position of it. But for some reason, it doesn't work. It always output 0 for some reason.
    import java.io.*;
    import java.util.*;
    - frog program class.
    frog will start on a position.
    user will be prompt to ask how many jump to forward.
    public class beta
         public static void main(String args[]) throws IOException
              class Frog
              int newPos;
                   int Position () //return postion of the frog
                   return newPos;
                   void PositionStart (int newPos) //initial postion of the frog
                   newPos = newPos;
                   int Jump(int stepsForward, int newPos)
                        newPos+=stepsForward;
                        return newPos;
                   int PrevPos(int newPos)
                   return newPos-1;
                   int NextPos(int newPos)
                   return newPos+1;
                   boolean isMagicSquare(int newPos)
                        if(newPos == 5) return true;
                        else return false;
         BufferedReader key = new BufferedReader(new InputStreamReader(System.in));
         Frog joe = new Frog();
         int pos = 0, stepsFoward = 0;
                   //input 1-9
                   do
                        System.out.println("Enter a position for the frog: ");
                        pos = Integer.parseInt(key.readLine()); //reads in an integer
                   }while(pos < 1 || pos > 9);
                   joe.PositionStart(pos); //initialize the position for the frog
                   System.out.println("Pos: " + joe.Position()); //position
                   System.out.println("How many steps to jump: ");
                   stepsFoward = Integer.parseInt(key.readLine());
                   joe.Jump(stepsFoward,joe.Position());
                   System.out.println("New Position: " + joe.Position());               
    }

    You have method argument parameters with the same name as a member variable; as in:
    void PositionStart (int newPos) {
            newPos = newPos;
    }You need to identify to the compiler which variable is which, class member variables in cases like this should be qualified with the this keyword; as in:
    void PositionStart (int newPos) {
            this.newPos = newPos;
    }Dave

  • Difference between narrow() method usage and simple class cast for EJB

    Hi,
    I have a very simple question:
    what is the difference between PortableRemoteObject.narrow(fromObj,
    toClass) method usage and simple class cast for EJB.
    For example,
    1)
    EJBObject ejbObj;
    // somewhere in the code the home.create() called for bean ...
    ABean a = (ABean)PortableRemoteObject.narrow(ejbObj,ABean.class);
    OR
    2)
    EJBObject bean;
    // somewhere in the code the home.create() called for bean ...
    ABean a = (ABean)ejbObj;
    Which one is better?
    P.S. I'm working with WL 6.1 sp2
    Any help would be appreciated.
    Thanks in advance,
    Orly

    [email protected] (Orly) writes:
    Hi,
    I have a very simple question:
    what is the difference between PortableRemoteObject.narrow(fromObj,
    toClass) method usage and simple class cast for EJB.
    For example,
    1)
    EJBObject ejbObj;
    // somewhere in the code the home.create() called for bean ...
    ABean a = (ABean)PortableRemoteObject.narrow(ejbObj,ABean.class);
    OR
    2)
    EJBObject bean;
    // somewhere in the code the home.create() called for bean ...
    ABean a = (ABean)ejbObj;
    Which one is better?(1) is mandated by the spec. It is required because CORBA systems may
    not have sufficient type information available to do a simple case.
    P.S. I'm working with WL 6.1 sp2 You should always use PRO.narrow()
    andy

  • Having trouble using a simple class..New to AS3

    Hello Everyone,
    I am new to AS3 but not to AS2. I have written a simple class
    and when I import it, I don't see the object that should be created
    upon calling the constructor. Can you guys tell me where am I going
    wrong. And I am very puzzled about 'document class'. Yes, I have
    google numerous threads on "document class" but still very shaky on
    this matter. Here is my simple class which should place a button
    object on the stage when I create a new object of this class.
    Once I have created the BTN class, I have made sure that I
    have button component in my library, I then instantiate the object
    by creating a new CS3 file and importing my class:
    import com.learning.as3.*;
    var b:BTN = new BTN();
    When I test the movie, I get the following errors:
    1172: Definition com.learning.as3 could not be found.
    1046: Type was not found or was not a compile-time constant:
    BTN.
    1180: Call to a possibly undefined method BTN.
    Any help would highly be appreciated.
    Thanks you.

    Hello Ned,
    Yes, I have made sure that my directory structure exist as it
    should be and yet I still get the errors.
    Thanks a lot.

  • Help on dynamically loading of simple classes - ClassLoader

    Hello,
    does somebody know how to load simple classes with java.lang.ClassLoader in a stateless session bean running on SneakPreview 6.40?
    i found many solutions for j2ee servers on the net but no one works. i always get a ClassNotFoundException but i can read the class file to a byte array.
    this is one way i tried to solve the problem:
    ClassLoader loader = Thread.currentThread().getContextClassLoader();
    Class aClass = Class.forName(strClassName, true, loader);
    hopefully someone can help me,
    thanks
    erich

    Hi Erich,
    for such a kind of problems (not knowing for sure where the classloader is looking for the class) I am used to use http://www.sysinternals.com/ntw2k/source/filemon.shtml
    Just write <i>Class.forName("ABC123", true, loader);</i> and then you can check the places where the classloader is looking for this ABC123 class...
    Hope it helps
    Detlev

  • Simple class runs 3x slower inside 8i than outside...why?

    I have a simple class to read a large number of numbers (1E6) and sort them using the java Collections.sort(). I tested the class in the JVM run as a Procedure and externally as a simple class on my desktop.Running Oracle 8i on Linux Redhat7.2. The external version runs about 3 times faster and I have no idea why.
    Running the class in the JVM: Server is a Compaq P800-256128US with PIII 800 MHz 256 KB cache & 256MB PC-133 and SCSI drives.
    Connection time: 0.004 seconds
    ArrayList build: 223.27 seconds
    Collection.sort(): 101.29 seconds
    Running the class on my workstation: Machine is a Compaq DeskPro w/PIII with 256MB.
    OP:Connecting...
    ----The operation took 5.734 seconds
    OP:Building List...
    ----The operation took 81.141 seconds
    OP: Sorting 1000000 items...
    ----The operation took 6.859 seconds
    Here is the class trivial logic:
    Connection conn = DriverManager.getConnection("jdbc:default:connection:");
    List list = new ArrayList();
    stmt = conn.createStatement();
    ResultSet rset = stmt.executeQuery("select List from NUMBERS");
    while (rset.next())
    list.add(Integer.valueOf(rset.getString(1)));
    Collections.sort(list);//sorting
    I have timing calls embedded not shown here in both versions to measure and of course the connection is different for external call.
    What do you think of these results? What should I check?
    Thanks,
    Chris

    Id like to follow up with some questions:
    1.)     Oracle documentation states that PL/SQL is the preferred tool for data intensive jobs. And Java Stored Procedures are preferred for more algorithmic jobs. This seems contrary to what you state. Can you clearify?
    2.)     When you say gen. purpose and cpu bound Java code, do you mean algorithmic code?
    3.)     I assume the points 1 and 2 in your response suggest that it takes so long to get the Java environment up and running that it is killing the performance of my simple algorithm...is that what you mean?
    4.)     My real goal is to use intelligent agents (use AI algorithms that are very expensive computationally) and are invoked upon updates and continually train on newly inserted data. The fact these guys can live in the Oracle JVM, be invoked upon an update using a trigger and call an EJB client in warning of a particular condition is what made me fall in love with this solution that Oracle provides. But do you think I am asking too much or Im going a bit beyond what the JVM is for?

  • Simple Class

    I am looking for help in developing a simple program to track input and then convert the running total when prompted. I am a novice, I know I need to implement a simple class, then use an object to track data in the class. I have the input parameters setup with the if-else supporting it.
    Looking for an example of reading point that would assist. Like I said, this is a simple program, not in production, more training level
    Thanks

    Well basically I need to take the user input value
    and store it somewhere, continue to prompt for more
    input for an undetermined period, then when prompted,
    print out the running total.So, you don't know how to do any of that?
    Start here:
    Sun's basic Java tutorial
    Sun's New To Java Center. Includes an overview of what Java is, instructions for setting up Java, an intro to programming (that includes links to the above tutorial or to parts of it), quizzes, a list of resources, and info on certification and courses.
    http://javaalmanac.com. A couple dozen code examples that supplement The Java Developers Almanac.
    jGuru. A general Java resource site. Includes FAQs, forums, courses, more.
    JavaRanch. To quote the tagline on their homepage: "a friendly place for Java greenhorns." FAQs, forums (moderated, I believe), sample code, all kinds of goodies for newbies. From what I've heard, they live up to the "friendly" claim.
    Bruce Eckel's Thinking in Java (Available online.)
    Joshua Bloch's Effective Java
    Bert Bates and Kathy Sierra's Head First Java.
    James Gosling's The Java Programming Language. Gosling is
    the creator of Java. It doesn't get much more authoratative than this.

  • A simple class vs. Stateless Session Bean

    If I want a stateless bean to do some simple work such as give it a number A
              and get A+10 in return, does the Stateless session bean really perform
              better than a simple class? In my project, there are lots of simple job like
              this, which one should I use? A Stateless session bean or a simple class?
              Besides, when is the right time to use a stateful session bean? I use the
              servlet to keep user information in the session, and than have the stateless
              session bean working with it...This pattern meets most requirement....So I'm
              wondering in what situation should I need to use stateful session bean?
              Thanks!
              

    - It is far better to use a stateless session bean when implementing the session-facade pattern.
    - Keeping a home interface on the object won't make him stateful.
    - with the stateless beans, you do not decide when they're created. The container does.
    - The number of entity beans is not so important. The only thing important is to have a remote methode in your stateless(es) for each atomic transaction ("atomic" meaning here "you cannot cut").
    /Stephane

  • A Simple Class

    Ok..ive tried an example of creating a simple class...but im getting an error when i try to load the jsp page within the web browser.
    org.apache.jasper.JasperException: Attempted a bean operation on a null object.
    My java code
    package booklibrary;
    public class Book
         private String title;
         public String getTitle(){
              return title;
         public void setTitle(String newTitle){
              this.title = newTitle;
    My JSP code
    <HTML>
    <HEAD>
    <TITLE>A Simple Class</TITLE>
    </HEAD>
    <BODY>
    <JSP:useBean id = "myBook" class = "booklibrary.Book"/>
    <JSP:setProperty name = "myBook"
                                  property = "title"
                                  value = "Begining JSP 2.0"/>
    Book Title: <jsp:getProperty name = "myBook" property = "title" />
    </BODY>
    </HTML>
    Anyone able to help me.Please

    import javax.swing.JOptionPane;
    public class SimpleDialog {
    public static void main(String[] args) {
      String inp = JOptionPane.showInputDialog(null,"input string");
      JOptionPane.showMessageDialog(null, "hi -- " + inp);
      //JOptionPane frame = new JOptionPane();
      //JOptionPane.showMessageDialog(frame, "hi");
      System.exit(0);
    } // method
    } // class hiDialog

  • How to deploy a simple class in Tomcat 5

    Hi All,
    Need your help...
    I have just started learning Java and JSP.
    I was trying to write a simple Shopping Cart program in JSP. I have created a directory under my root context directory. But while I am invoking the JSP, I am getting a error like this:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 18 in the jsp file: /JspSessionCart/build/carts.jsp
    Generated servlet error:
        [javac] Compiling 1 source file
    C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\mycontext\org\apache\jsp\JspSessionCart\build\carts_jsp.java:64: package sessions does not exist
          sessions.DummyCart cart = null;
                  ^
    An error occurred at line: 18 in the jsp file: /JspSessionCart/build/carts.jsp
    Generated servlet error:
    C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\mycontext\org\apache\jsp\JspSessionCart\build\carts_jsp.java:66: package sessions does not exist
            cart = (sessions.DummyCart) _jspx_page_context.getAttribute("cart", PageContext.SESSION_SCOPE);
                            ^
    An error occurred at line: 18 in the jsp file: /JspSessionCart/build/carts.jsp
    Generated servlet error:
    C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\mycontext\org\apache\jsp\JspSessionCart\build\carts_jsp.java:68: package sessions does not exist
              cart = new sessions.DummyCart();
                                 ^
    An error occurred at line: 33 in the jsp file: /JspSessionCart/build/carts.jsp
    Generated servlet error:
    C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\mycontext\org\apache\jsp\JspSessionCart\build\carts_jsp.java:92: package util does not exist
    out.print(util.HTMLFilter.filter(items));
    ^
    An error occurred at line: 33 in the jsp file: /JspSessionCart/build/carts.jsp
    Generated servlet error:
    Note: C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\mycontext\org\apache\jsp\JspSessionCart\build\carts_jsp.java uses unchecked or unsafe operations.
    An error occurred at line: 33 in the jsp file: /JspSessionCart/build/carts.jsp
    Generated servlet error:
    Note: Recompile with -Xlint:unchecked for details.
    4 errors
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:127)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
         org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:415)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:458)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:553)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    I am not able to understand what to do? Do I need to set any CLASSPATH? If yes, kindly tell me what would the path for CLASSPATH.
    Kindly help me....
    Thanks.,
    Ujjal                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Ujjal wrote:
    Hi All,
    Need your help...
    I have just started learning Java and JSP.
    I was trying to write a simple Shopping Cart program in JSP. I have created a directory under my root context directory. But while I am invoking the JSP, I am getting a error like this:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 18 in the jsp file: /JspSessionCart/build/carts.jspMaybe you should look at that JSP. It's incorrect, obviously.
    Look, here's a hint:
    C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\mycontext\org\apache\jsp\JspSessionCart\build\carts_jsp.java:66: package sessions does not exist
    cart = (sessions.DummyCart) jspxpage_context.getAttribute("cart", PageContext.SESSION_SCOPE);Why isn't this a good enough guide?

  • Need simple class for communicating with Solaris account

    Hey, gang. After over a week of searching this forum and the Web for a solution, I'm stuck. I hope someone here can help.
    I've got a Java application intended to run on both Windows and Solaris systems that needs to perform the following automated operations:
    1. Connect to a user account on a Solaris server.
    2. Login.
    3. Run an sccs command.
    4. Retrieve the output from the sccs command.
    I can run commands (such as sccs) directly from Java; I've worked out how to do that. My situation is that I need to run sccs from an authorized account so that all file checkin/checkout operations are tagged properly. So the requirement to connect to a server isn't one I can ignore. I also don't need a full-up interactive client interface -- this needs to be an automated process.
    What I'm hoping is that someone here will be willing to provide (or point me to) some relatively simple source code I can call to do this stuff. Maybe an example of a class that uses Socket and a couple of streams to programmatically connect to a server, send commands, and capture input. That's really all I need.
    I've tried calling the Jakarta Commons telnet class to connect to the Solaris server, but it's more overhead than I need. (Plus the input stream kept blocking when I tried to use it in a purely automated mode.) I've also tried rolling my own code using the minimal info available on Google, but have not been able to figure out the magic words necessary to get anything back but gibberish. (InputStream and BufferedReader just do not seem to want to cooperate. Either I get back only garbage text, or readLine() or read() gets nothing and just sits and waits until the timeout.)
    So I turn to the experts here. If anyone can offer (or direct me to) any simple, non-libraried source code that enables my Java code to connect to and talk to a Solaris machine, I'd be grateful.
    Thanks!

    I was hoping a separate server-side process wouldn't be needed -- if you're thinking of something like RMI, that's also a bit heavyweight for my needs. I know I can talk to the remote server on telnet port 23, though.
    Further experimentation today with the Jakarta net library has generated something that works using their telnet classes. (After I asked for help here, of course. The same thing happens when I shop for groceries....) But using this leaves me referencing an external library that:
    1. has functionality I don't need that complicates the code, and
    2. forces me to address licensing requirements.
    So I'd still love to see an example of a telnet-like Java class that strips away all the non-essentials in the Jakarta telnet library code, leaving behind a simple public domain class that can be used to connect to a remote host and transfer characters over that connection.
    I appreciate that this may be asking for a lot, but as they say, if you don't ask, you don't get. ;-)
    Thanks!

  • Is it possible to execute simple class

    Sir,
    Is it possible to execute a simple program written in java in
    jdeveloper. If yes please let me know how to that.
    I creted a class using class wizard and added the following
    statement;
    System.out.println("testing");
    I able to compile the program without error, but how to execute
    it.
    raghu
    null

    Hi Jun Wu,
    Because without deploying, it doesn't allow me check how my java webdynpro application works!!
    I  need to execute my java web dynpro application and I dont have any access to SDM pins/passwords.
    Please share your valuable thoughts on the same.
    regards,
    Ajeeth Kumar S

  • Writing a whole class instance to a file

    Is it possible to write an intance of a class to a file whole?
    My problem is as follows I have a complicated class system for the piece of software i am currently writing this has vector classes upon vector classes upon vector classes etc. The top class is called rulelist. Having created an instance of this class in the main method and added various instances of other classes to it i want to be able to save this instance on exiting the program. I know how to write individual pieces of data to a file but is there an easier way to do this than to save all the data individualy and then re-sort it out when loading the instance again?
    Please help
    Will

    Sun has some tech tip articles on serialization:
    http://developer.java.sun.com/developer/JDCTechTips/
    Do a search for 'serialization' on this webpage.

  • Simple class Evolution with DPL fails.

    Hi
    I added a simple integer field to an existing class, used with DPL and during startup next time get this error. From the documentation, this type of class evolution should work automatically. But I get following exception. Does it require some extra configuration? I cant seem to locate that in the documentation.
    com.sleepycat.persist.evolve.IncompatibleClassException: Changes to the fields or superclass were detected when evolving class: com.pkg.TestClass version: 0 to class: com.ul.users.UserProfile version: 0 Error: A new higher version number must be assigned
    at com.sleepycat.persist.impl.PersistCatalog.<init>(PersistCatalog.java:338)
    at com.sleepycat.persist.impl.Store.<init>(Store.java:172)
    at com.sleepycat.persist.EntityStore.<init>(EntityStore.java:148)

    Hi,
    The exception message "A new higher version number must be assigned" means that you have to explicitly specify a version parameter in your Entity or Persistent annotation.
    This is explained in the com.sleepycat.persist.evolve package description here:
    http://www.oracle.com/technology/documentation/berkeley-db/je/java/com/sleepycat/persist/evolve/package-summary.html
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • High Score Table: Writing a Simple Text File with Flash and PHP

    I am having a problem getting Flash to work with PHP as I need Flash to read and write to a text file on a server to store simple name/score data for a games hi score table. I can read from the text file into Flash easily enough but also need to write to the file when a new high score is reached, so I need to use PHP to do that. I can send the data from flash to the php file via POST but so far it is not working. The PHP file is confirmed as working as I added an echo to the file which displayed a message so I  could check that the server was running PHP - the files were also uploaded to a remote server so I  could test them properly. Flash code is as follows:
    //php filewriter
    var myLV = new LoadVars();
    function sendData() {
    //sets up variable 'hsdata' to send to php
    myLV.hsdata = myText;
    myLV.send("hiscores.php");
    I believe this sends the variable 'myText' to the php file as a variable called 'hsdata' which I want the php file to write into a text file. The mytext variable is just a long string that has all the scores and names in the hiscore. OK, XML would be better way of doing this but for speed I just want to get basic functionality working, so storing a simple text sting is adequate for now. The PHP code that reads the Flash 'hsdata' variable and writes it to the text file 'scores.txt' follows:
    <?php
    //assigns to variable the data POSTed from flash
    $flashdata = $_POST["hsdata"];
    //file handler opens file and erases all contents with w arg
    $fh = fopen("scores.txt","w");
    //adds data to file
    fwrite ($fh,$flashdata);
    //closes file
    fclose ($fh);
    echo 'php file is working';
    ?>
    Any help with this would be greatly appreciated - once I can get php to write simple text files I should be ok. Thanks.

    Thanks for your help.
    I have got Flash working to a certain extent with PHP using loadVars but have been unable to get flash to receive a variable declared in PHP. Here's my Flash code:
    var outLV = new LoadVars();
    var inLV = new LoadVars();
    function sendData() {
    outLV.hsdata = "Hello from Flash";
    outLV.sendAndLoad("http://www.mysite.com/hiscores/test23.php",inLV,"post");
    inLV.onLoad = function(success) {
    if (success) {
      //sets dynamic text box to show variable sent from php
      statusTxt.text = phpmess;
    } else {
      statusTxt.text = "No Data Received";
    This works ok and the inLV.onLoad function reports that it is receiving data but does not display the variable received from PHP. The PHP file is like this:
    <?php
    $mytxt =$_POST['hsdata'];
    $myfile = "test23.txt";
    $fh = fopen($myfile,'w');
    //adds data to file
    fwrite($fh, $mytxt);
    //closes file
    fclose ($fh);
    $mess = "hello there from php";
    echo ("&phpmess=$mess&");
    ?>
    The PHP file is correctly receiving the hsdata from flash and writing it to a text file, but there seems to be a problem with the final part of the code which is intended to send a variable called 'phpmess' back to Flash, this is the string "hello there from php". How do I set up Flash and PHP so that PHP can send a variable back to Flash using echo? Really have tried everything but am totally baffled. Online tutorials have given numerous different syntax configurations for how the PHP file should be written which has really confused me - any help would be greatly appreciated.

Maybe you are looking for