ActionScript parser?

I was looking for an ActionScript and syntax color
highlighter. Several places I read about one by Brett Errington
which should be downloadable from his website
http://be.nw.com.au/ but this
address is not working. Is there anybody who has the parser and
would be willing to send it to me?
Please contact me at www.winternet.no
Regards,
Allan Jensen

I have a copy.  you can email me at [email protected] if it is urgent.
otherwise I'll be putting a copy up on my asp4hs site.  I had been linking to Brett's site, but that's obviously not working right now.
it'll be here... probably later tonight when I can fix it.
http://www.wilk4.com/asp4hs/list2.htm#flmxact_parser
jeff
-- Jeff Wilkinson
volunteer for HomeSite
see Asp4Hs: ASP/PHP/.Net/etc Development Extensions for HomeSite
http://www.wilk4.com/asp4hs

Similar Messages

  • ActionScript Parser in ActionScript?

    Hi all,
          In the previous and old post (http://forums.adobe.com/message/223435) , people (and I) asked about a parser for ActionScript. My post was never  responsed, I am not sure whether the forum is still activated or not?
           I need if there is an ActionScript parser written in ActionScript. I know there are (almost complete) parsers for ActionScript (FlexPMD), but this one is in Java and is not very documented (the parser API at least).  I need the parser to modify source code (eg. wrap functions). If anybody has an idea, I would apreciate to hear it.
           PS: I looked about metaprogramming in AS3 as well, but it seems to be limited
    Thanks in advance,
    Paul 

    I don't know anything about that parser. But Java comes with a compliant XML parser built into it. Unless you have some special requirements for parsing you could just use that.

  • Problems with the Actionscript parser

    We just upgraded to MX 7.02 from MX 6.1 here. I've been
    playing around with the new flash forms and actionscript to see how
    easy it would be to replicate some of the things we did with
    javascript in actionscript.
    While debugging one of the scripts I noticed that whatever
    parses the actionscript for syntax errors was picking up illegal
    keywords in areas where keywords aren't typically allowed. It finds
    them in comments, strings, tooltips, and just about anywhere
    actionscript is allowed. Unfortunately, three of the keywords
    (import, new, and delete) are pretty common in comments and
    tooltips.
    I didn't notice anything about this in the known issues for
    7.02. Is anyone aware of a current hotfix or one coming soon to fix
    this issue? Are there any workarounds or should I just try to avoid
    the use of those words until the next update?

    We just upgraded to MX 7.02 from MX 6.1 here. I've been
    playing around with the new flash forms and actionscript to see how
    easy it would be to replicate some of the things we did with
    javascript in actionscript.
    While debugging one of the scripts I noticed that whatever
    parses the actionscript for syntax errors was picking up illegal
    keywords in areas where keywords aren't typically allowed. It finds
    them in comments, strings, tooltips, and just about anywhere
    actionscript is allowed. Unfortunately, three of the keywords
    (import, new, and delete) are pretty common in comments and
    tooltips.
    I didn't notice anything about this in the known issues for
    7.02. Is anyone aware of a current hotfix or one coming soon to fix
    this issue? Are there any workarounds or should I just try to avoid
    the use of those words until the next update?

  • Flash and closed-captioning

    How is the closed-captioning handled on the sample
    success
    story about Sony's use of Flash?
    Thanks.

    Nickels55,
    > There is a different method that I have been unable to
    figure
    > out. If you use captivate you can sync captions with
    audio.
    I haven't used Captivate, but I've heard of this approach
    quite often.
    Sooner or later, I ought to check it out. :)
    > Walter's idea is the way to go though, but that way is
    all
    > manual labor...
    Respectfully, I disagree. Closed captioning is manual labor,
    period
    (well, unless Captivate assists the workflow). Someone's got
    to listen to
    the audio and painstakingly transcribe the dialog, in
    addition to noting the
    timing of phrases. In my experience, this is easiest to
    handle in XML.
    Then ActionScript parses that XML, assigns cue points to the
    video by way
    of, say, the FLVPlayback Component, and listens for the
    cuePoint event.
    These events can trigger peripheral animation, pause and
    advance the
    timeline (etc.) and display closed captions. If the FLA needs
    to change, no
    problem. If the frame rate of either the FLV or the SWF needs
    to change, no
    problem. If a spelling mistake is discovered that ripples
    through the whole
    scription ... no problem. If the text formatting changes
    throughout, no
    problem.
    In addition, the FLV -- especially one of the length shown
    -- simply
    shouldn't be imported directly into a FLA. It would make the
    SWF at least
    as large as the FLV itself, which might be dozens of
    megabytes. Instead,
    load the FLV at runtime. It starts playing almost
    immediately, the SWF is
    small, and you have all the benefits described above for the
    captions.
    David Stiller
    Adobe Community Expert
    Dev blog,
    http://www.quip.net/blog/
    "Luck is the residue of good design."

  • Parser similar to Actionscript 3(Standard ECMA-357)

    Hi i've used the xml parser in Actionscript 3 extensively and i'm wondering if there is a similar parser i Java(it seems to be kind of a jungle)
    Edited by: Kribba on Oct 25, 2007 1:59 AM

    I don't know anything about that parser. But Java comes with a compliant XML parser built into it. Unless you have some special requirements for parsing you could just use that.

  • WSDL Parsing in ActionScript

    Hi...
    I want to parse WSDL url and show the user the list of
    methods ,parameters and data type for each method using
    actionscript.I s there any parser available for doing so?

    When you issue a CREATE OR REPLACE PROCEDURE (or function or package), the PL/SQL code is "compiled" - i.e. full parsing and scope checking are done and the result saved (if successfully compiled) in executable p-code format. The code itself is however not executed.
    If there are any syntax or object reference errors, these will be displayed.
    Thus if you want to parse your code without executing it, the norm is to simply save the code to the database - where it belongs anyway.
    Note that this parsing and compiling does not ensure that your code works "properly".
    The correctness, efficiency and scalability of your code is your responsibility. A parser cannot report on business logic errors.

  • Using Actionscript to generate a grid

    Hello all.
    I am working on a Flash project and have a problem that has
    turned out to be a real head scratcher for me. I need to create a
    Flash form that will generate a floorplan grid based upon width and
    length values entered by the user. I have successfully completed
    part of the task and I am able to generate a grid based upon the
    width and length entered by the user.
    Here is my problem: When the Width and Length "units" are
    entered as feet, I need to generate a grid that displays 1 grid
    square for every 5 feet of length or width entered, (the scale is 1
    square grid = 5 ft so if you entered a 50 ft building length or
    width the "length or width" side of the grid would be 10 grid units
    in length). Then, if the user re-enters new values for the width
    and height and clicks "draw floorplan"
    again
    the grid needs to regenerate
    again
    at the proper size. Currently my sample generates 1 grid for
    every foot of length or width entered and will not regenerate
    properly.
    Below is a link to a sample of where I am so far as well as
    the Actionscript I am using to control the sample file.
    Can anyone provide some pointers on how to generate the grid
    with one grid representing 5ft and how to regenerate the grid once
    new values are input and the "draw floorplan" button is clicked
    again? (Also, ultimately I need to then send the form data as
    email.)
    Any help is very much appreciated!
    Bitjammer
    Link to sample:
    http://216.197.127.249/grid/grid_sample_1.html
    (Try entering 10 width and 10 length then click draw floor
    plan)
    Here is my actionscript code so far:
    my_button.addEventListener("onPress",gridf);
    my_button.onPress=function(){if(Number(widthTF.text)>1&&Number(heightTF.text)>1){gridF(Num ber(widthTF.text),Number(heightTF.text))
    function gridF(h,w){
    initX = 0;
    initY = 0;
    counter = 0;
    for (var i = 1; i<=h; i++) {
    for (var j = 1; j<=w; j++) {
    counter++;
    grid_container.attachMovie("cellMC", "cell"+counter,
    counter);
    grid_container["cell"+counter]._x = initX;
    grid_container["cell"+counter]._y = initY;
    initX += 15;
    initY += 15;
    initX = 0;
    (For clarification: the width input variable is widthTF and
    height input varible is heightTF.)

    Thanks for taking time to answer my post, kglad.
    Yes. I believe I understand. I could create another button
    and call it "Reset Grid" and call this function, however what I am
    hoping for is to have the grid redraw simply by the user entering
    new values for the width and height and then clicking "draw
    floorplan" again.
    Currently the first line of code is:
    my_button.addEventListener("onPress",gridf); Should not the grid
    redraw each time and then parse the new values in the width and
    height fields? I am sure I am just dense but my grid is not
    clearing each time the "draw " button is clicked.
    You can see this happen on the sample link below. After
    entering say 20 width and 20 height values and clicking "draw"
    button, the grid is created perfectly. Then if, say new values of
    10 width and 10 height are entered and "draw" button is clicked,
    the grid does not redraw correctly using these new values.
    Sample link:
    http://216.197.127.249/grid/grid_sample_1.html
    Could the problem be that the gridf function should happen as
    the first function in the script before the new values are parsed
    again? Should a: grid_container.removeMovieClip(); execute before
    anything else is executed each time the "draw" button is clicked?

  • Specify the GUI declaratively in ActionScript like in JavaFX Script instead of MXML

    After reading a bit about JavaFX Script (which is actually remarkebly close to ActionScript 3) as a developer I thought the way one can specify the GUI declaratively in JavaFX Script via JSON-like notation for the components is pretty cool. It would be nice to have something like that in Flex/ActionScript too. The advantages I see over MXML are:
    1) a more compact notation than XML which is nice from a developers view point who actually writes this kind of code. Of course the idea would be that designers still design the GUI with graphical tools that generate this code but if you have to dive in and edit the code it's nice not to have to deal with verbose XML and I think even designers can easily understand JSON-like code; don't just assume that designers love XML because HTML was based on SGML! I'm not so sure if today many designers really still know raw HTML that well (like in 1997, the early days...). Server side developers probably know it better because they have to adapt it to jsp or asp or whatever framework.
    2) The fact that it's all ActionScript gives a seamless integration between just composing the components to form the GUI and adding scripts to add additionial behavior instead of mixing XML with actionscript code => no more need for those nasty CDATA blocks! It would also be easy for development tools like Flexbuilder to give a seamsless experience with code completion and zooming in on the code because it's all Actionscript! There's also no need for a separate expression language to tie the MXML to the underlying Actionscript. It would it also make easier to create custom components (not just simple composition components which is really easy in MXML) because you don't have to implement separate XML tags.
    here's a short JavaFX Script example:
    Frame {
    content: GroupPanel {
    var myRow = Row { alignment: BASELINE }
    var label_col = Column { alignment: TRAILING }
    var field_col = Column { alignment: LEADING }
    rows: [myRow]
    columns: [label_col, field_col]
    content:
    [SimpleLabel {
    row: myRow
    column: label_col
    text: "Type your text here:"
    TextField {
    row: myRow
    column: field_col
    columns: 50
    visible: true
    Note that this shouldn't be confused with programmatically specifying the GUI in Actionscript (which is possible today as an alternative to MXML). What I propose is at a (slightly) higher level: you don't give a detailed sequence of methods/functions to call to construct the GUI (i.e. HOW to do it) but just specify WHAT you want.
    Hopefully some Adobe Flex will see this and think about it. Although I think MXML is not too bad and I can live with it if I have to ;)

    I like that idea Sean. A standard and well-supported way to separate MXML and code would be good. I'd love to have builder support a MVC style triad for MXML files, with the
    model.as being simply an all-public-all-bindable class full of VOs and view-specific information, any view-manipulation and view<->app communications in the
    controller.as, and nothing but bindings and layour in the MXML. There's (almost) nothing stopping you doing this by hand at the moment, but it's a pain, and developers wouldn't stick to it for very long, when they need to create and maintain 3 separate files for that simple "error dialog" without a hand from Builder.
    Then again, I'd rather Adobe spent the time that would take on opening and better-documenting builder's APIs, so we can write our own plugins easily, but that's my greedy side- A standard builder-supported MVC pattern for custom MXML components would be aweseome for people that aren't me :)
    -Josh
    As for JavaFX, I don't care for it.
    On Tue, Sep 30, 2008 at 7:56 AM, Sean Christmann
    <
    [email protected]> wrote:
    A new message was posted by Sean Christmann in
    Developers --
      specify the GUI declaratively in ActionScript like in JavaFX Script instead of MXML
    Jason you bring up a good point on a concept that I think Adobe should
    poach from a different framework, Silverlight. In Silverlight the
    code-behind pattern is automatic and very nice to work with. Every
    interface can be composed of both a layout file and a script file, and
    they get composited into the SAME class at compile time. So you can
    have both a FileDialog.mxml and FileDialog.as file that know about each
    other automatically, without the need to subclass one from the other.
    Sean
    Jason Stafford wrote:
    A new message was posted by Jason Stafford in
    Developers --
      specify the GUI declaratively in ActionScript like in JavaFX Script instead of MXML
    Personally, I like the separation between the MXML and ActionScript.
    We're working on a large project, and so we have all the ActionScript
    separate from the MXML files.  For example we'll have something like
    filedialoglayout.mxml, and then
    filedialog.as that is a subclass of
    filedialoglayout.  All event handlers and the like are setup in the
    filedialog.as file - the mxml file doesn't know about any function names.
    Advantages:
    MXML files become layout only - and are more easily shared and worked on
    with non-technical people
    ActionScript is all in *.as files: no CDATA blocks and no FlexBuilder
    quirks where editing ActionScript inside a CDATA block doesn't work
    quite like in a real AS file.
    For simple experiments, and for learning, it's obviously nice to have
    everything in one mxml file, but in a big project like ours, the
    separation helps keep things clearer and more maintainable.
    Why use the mxml at all?  The MXML files are nice to edit with the
    visual editor in Flex Builder, and it's much easier to apply styles and
    embed assets in MXML than it is in pure ActionScript.
    I think two ways to talk about the same thing (XML and ActionScript) is
    already almost one too many - adding a third (JSON) would really be too
    much.
    Just my thoughts.
    -Jason Stafford
    Sean Christmann wrote:
    A new message was posted by Sean Christmann in
    Developers --
    specify the GUI declaratively in ActionScript like in JavaFX Script
    instead of MXML
    This reminds me of a certain workflow pattern that has emerged for us
    which might help provide some insight on this topic. I'm working on a
    project with a couple other developers which connects to a webservice
    for supplying clientside data. This data is available in both json
    notation and xml notation. The thing is, while the developers have
    overwhelmingly agreed that we should be consuming the json version
    since it can be parsed faster and provide more meaningful context for
    objects (ie strings vs ints vs arrays etc...), all these same
    developers rely exclusively on the xml notation when asking questions
    about the data or passing structures around to discuss.
    I see the same thing when looking at JavaFX and MXML. JavaFX might
    allow for more accurate structures and might be able to be compiled
    faster, but MXML is better for being self documenting even if it
    requires more verbosity.
    Sean
    Matt Chotin wrote:
    A new message was posted by Matt Chotin in
    Developers --
      specify the GUI declaratively in ActionScript like in JavaFX Script
    instead of MXML
    I'd be curious what other people think.  I see MXML as a distinct
    advantage over doing the pseudo-script stuff.  I really don't like
    the JavaFX system actually.
    Matt
    On 9/28/08 10:33 AM, "neo7471"
    <[email protected]> wrote:
    A new discussion was started by neo7471 in
    Developers --
      specify the GUI declaratively in ActionScript like in JavaFX Script
    instead of MXML
    After reading a bit about JavaFX Script (which is actually remarkebly
    close to ActionScript 3) as a developer I thought the way one can
    specify the GUI declaratively in JavaFX Script via JSON-like notation
    for the components is pretty cool. It would be nice to have something
    like that in Flex/ActionScript too. The advantages I see over MXML are:
    1) a more compact notation than XML which is nice from a developers
    view point who actually writes this kind of code. Of course the idea
    would be that designers still design the GUI with graphical tools
    that generate this code but if you have to dive in and edit the code
    it's nice not to have to deal with verbose XML and I think even
    designers can easily understand JSON-like code; don't just assume
    that designers love XML because HTML was based on SGML! I'm not so
    sure if today many designers really still know raw HTML that well
    (like in the 1997, the early days...). Server side developers
    probably know it better because they! have to adapt it to jsp or asp
    or whatever framework.
    2) The fact that it's all ActionScript gives a seamless integration
    between just composing the components to form the GUI and adding
    scripts to add additionial behavior instead of mixing XML with
    actionscript code => no more need for those naster CDATA blocks! It
    would also be easy for development tools like Flexbuilder to give a
    seamsless experience with code completion and zooming in on the code
    because it's all Actionscript! There's also no need for a separate
    expression language to tie the MXML to the underlying Actionscript.
    It would it also make easier to create custom components (not just
    simple composition components which is really easy in MXML) because
    you don't have to implement separate XML tags.
    here's a short JavaFX Script example:
    Frame {
        content: GroupPanel {
        var myRow = Row { alignment: BASELINE }
        var label_col = Column { alignment: TRAILING }
        var field_col = Column { alignment: LEADING  }
        rows: [myRow]
        columns: [label_col, field_col]
        content:
        [SimpleLabel {
        row: myRow
        column: label_col
        text: "Type your text here:"
        TextField {
        row: myRow
        column: field_col
        columns: 50
        visible: true
    Note that this shouldn't be confused with programmatically specifying
    the GUI in Actionscript (which is possible today as an alternative to
    MXML). What I propose is at a (slightly) higher level: you don't give
    a detailed sequence of methods/functions to call to construct the GUI
    (i.e. HOW to do it) but just specify WHAT you want.
    Hopefully some Adobe Flex will see this and think about it. Although
    I think MXML is not too bad and I can live with it if I have to ;)
    View/reply at specify the GUI declaratively in ActionScript like in
    JavaFX Script instead of MXML
    <
    http://www.adobeforums.com/webx?13@@.59b69b42>
    Replies by email are OK.
    Use the unsubscribe
    <
    http://www.adobeforums.com/webx?280@@.59b69b42!folder=.3c060fa3>
    form to cancel your email subscription.
    View/reply at
    <
    http://www.adobeforums.com/webx?13@@.59b69b42/0>
    Replies by email are OK.
    Use the unsubscribe form at
    <
    http://www.adobeforums.com/webx?280@@.59b69b42!folder=.3c060fa3> to
    cancel your email subscription.
    <div><div></div><div>
    Jason Stafford
    Principal Developer
    Inspiration Software, Inc.
    The leader in visual thinking & learning
    Now available - Kidspiration(r) 3, the visual way to explore and understand words, numbers and concepts.
    Learn more at
    www.inspiration.com/kidspiration.
    503-297-3004 Extension 119
    503-297-4676 (Fax)
    9400 SW Beaverton-Hillsdale Highway
    Suite 300
    Beaverton, OR 97005-3300
    View/reply at
    <
    http://www.adobeforums.com/webx?13@@.59b69b42/2>
    Replies by email are OK.
    Use the unsubscribe form at
    <
    http://www.adobeforums.com/webx?280@@.59b69b42!folder=.3c060fa3></div>
    </div> to cancel your email subscription.
    Sean Christmann | Experience Architect | EffectiveUI | 720.937.2696
    View/reply at
    specify the GUI declaratively in ActionScript like in JavaFX Script instead of MXML
    Replies by email are OK.
    Use the
    unsubscribe form to cancel your email subscription.
    "Therefore, send not to know For whom the bell tolls. It tolls for thee."
    http://flex.joshmcdonald.info/
    :: Josh 'G-Funk' McDonald
    :: 0437 221 380 ::
    [email protected]

  • Reading an xml file in actionscript using flex3

    plzz tell me how to read an xml file in actionscript using flex3.......

    One possible option to parse an xml-file to a flex XML object:
    public function parseConXML(source:String):void
                    xmlLoader = new URLLoader();
                    xmlLoader.load(new URLRequest(source));
                      // Eventlistener: if URL loaded --> onLoadComplete function
                      xmlLoader.addEventListener(Event.COMPLETE, xmlLoadComplete);
                public function xmlLoadComplete(evt:Event):void{               
                    var xml:XML = new XML();
                     // ignore comments in XML-File
                    XML.ignoreComments = true;  
                       //ignore whitespaces in XML-File
                     XML.ignoreWhitespace = true;
                    // XML-Objekt erstellen
                    xml = new XML(evt.target.data);
                   //AFTERWARDS use your xml as your wish

  • Repeated retrieval and parsing of XML file causes IE to display an error message

    I have a flash application that makes a HTTP call every 120
    seconds to retrieve a xml file. This file is being generated with
    fresh data every few minutes or so and pushed to the apache web
    root with a unix mv command.
    I'm using the standard Flash XML object. The HTTP request is
    NOT over SSL (I know there is a bug related to this). Here is the
    code to make the retrieval:
    xmlData = null;
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = xmlTraverse;
    xmlData.load("
    http://domain/dir/somefile.xml");
    The "xmlTraverse" method was written by my team. There is no
    known bug in the parsing logic.
    Intermittently and unpredictably, IE will display the
    following dialogue box:
    "A script in this movie is causing Macromedia Flash Player 8
    to run slowly. If it continues to run, your computer may become
    unresponive. Do you want to abort the script?"
    I originally leaned toward an infinite loop causing this
    problem. The timeline jumps back and forth between two frames,
    checking in the latter frame if the xml has been loaded and parsed
    before allowing execution to move to the next frame. I hardcoded
    the loop check to always be false, but this did not produce the
    message above (although it pegged my CPU).
    The only scenario where I've managed to reproduce the message
    above is by making a huge (50 MB) xml file. This consistently
    produces the message. But I don't realistically see how our xml
    file could ever be over 1 MB.
    First, can anyone cite another cause for this message? I'm
    starting to lean towards the issue lying in our parsing logic such
    as infinite recursion on a badly formed XML file. Second, does
    anyone know of a solid xml SAX parsing actionscript utility where
    you can assign callbacks to XML nodes? If the problem is in the
    parsing, we may have to replace our homegrown solution with
    something more robust and proven.

    Is it a recursive parsing function? I'm not sure about this,
    but I think this message pops up when there are more than 256
    iterations in a loop (I've read something about this 256 limit,
    that will end while loops if they exceed this, but with another
    error message... but again, I'm not totally sure about that).
    The message is typically for loops, but I don't know when it
    fires. Sometimes it appears for really 'small' loops when you're
    using the debugger (e.g. a for loop with 100 iterations), so maybe
    it is connected to the time a loop is running. You could place some
    trace statements in the xmlTraverse method, to see where the
    function was when the message occurs, or take the time the function
    needs and check if this might be related to the error.
    That's all I can come up with, guess there are people here
    with more insight to this...
    cheers,
    blemmo

  • Flex RPC mapping Java nested classes to ActionScript classes

    We are calling a Java method in our project using
    RemoteObject the value returned by the java method is a ArrayList
    containing instances of a class say ParentClass with some nested
    classes.
    The structure of ParentClass(Java) is something like this
    class ParentClass {
    //some primitives
    private ChildClassA childAInstance;
    private ChildClassB childBInstance;
    //getters setters
    We have created similar class structure on the ActionScript
    side, the ActionScript classes(ParentClass,ChildClassA
    ,ChildClassB) have been properly annotated with the [RemoteClass]
    metadata tag,
    The problem is that though i'm getting the primitive data
    members of the ParentClass through RPC in my corresponding AS
    ParentClass class i'm getting an runtime exception trying to access
    ChildClassA,ChildClassB members.
    Am i missing something, exactly the same scenario is
    mentioned in this article
    http://www.adobe.com/devnet/flex/articles/complex_data.html
    But the Object.registerClass method mentioned in the tutorial
    is giving me compilation error, the sample code attached with the
    article is corrupt zip too.
    Please help me out on this

    JAXB will create classes from an XML schema, SAX is a parser library and JAXP is a library of XML a bunch of XML tools.
    I don't care for JAXB too much. I would skip it and go right to the JAX-RPC spec (WebServices).

  • Edge Animate/javscript API command similar to Actionscript fscommand('quit')?

    Our company recently replaced Flash with Edge Animate due to some major memory leak issues when pulling in dynamic data for our digital signage.
    In Actionscript, it was easy to signal to the digital signage player that the movie was ending with a custom fscommand.
    However, in HTML5, im having issues with how to do this in javascript. I currently do not see anything in the JSAPI for Edge Animate that would allow me to signal a third party player to end and unload the animation that is playing.
    I need to do this because the length of the animation is based on how much XML data I parse. This amount of data can change daily (10 seconds per xml node).
    Has anyone has a similar issue with this in the past and found a solution?
    Or perhaps I'm doing this incorrectly and I should be dynamically be creating the animation based on the available nodes in the timeline.
    Any feedback would be appreciated.

    Hi ,
    We have a timeline complete event in Edge Animate which would signal the completion of the animation. You can add your code for the timeline complete and then perform the appropriate action here.
    Thanks and Regards,
    Sudeshna Sarkar

  • WebService response object in XML - parsing attributes

    Hi- new to Flex and I'm trying to parse out the attributes of the response object. I can get the entire object and see that its working, but I cant get just a single attribute. It pulls weather info for world cities. For example, I just want the location name and temperature.
    Any advice on this? Thanks!
    <?xml version="1.0"?>
    <!-- fds\rpc\RPCResultFaultMXML.mxml -->
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                    xmlns:s="library://ns.adobe.com/flex/spark">
        <mx:Script>
            <![CDATA[
                import mx.rpc.soap.SOAPFault;        
                import mx.rpc.events.ResultEvent;
                import mx.rpc.events.FaultEvent;
                import mx.controls.Alert;
                import mx.utils.ObjectUtil;
                public function showErrorDialog(event:FaultEvent):void {
                    // Handle operation fault.
                    Alert.show(event.fault.faultString, "Error");
                public function defaultFault(event:FaultEvent):void {
                    // Handle service fault.
                    if (event.fault is SOAPFault) {
                        var fault:SOAPFault=event.fault as SOAPFault;
                        var faultElement:XML=fault.element;
                        // You could use E4X to traverse the raw fault element returned in the SOAP envelope.
                    Alert.show(event.fault.faultString, "Error");              
                public function log(event:ResultEvent):void {
                    // Handle result.
                    trace(event.result);
                    //trace(ObjectUtil.toString(event.result));
                    //var len:int;
                    //len = event.result.length;
                    //trace(len);
                    //trace(event.result);
                    //trace(event.result.GetWeatherResponse.Location);
                    //var myXML:XML = new XML(event.result);
                    //trace(myXML.attribute("Location"));
            ]]>
        </mx:Script>
        <mx:WebService id="WeatherService" wsdl="http://www.webservicex.com/globalweather.asmx?wsdl"
                       fault="defaultFault(event)">
            <mx:operation name="GetWeather"
                          fault="showErrorDialog(event)"
                          result="log(event)"
                          resultFormat="xml">
                <mx:request>
                    <CityName>{myCity.text}</CityName>
                    <CountryName>{myCountry.text}</CountryName>
                </mx:request>
            </mx:operation>
        </mx:WebService>
        <mx:TextInput id="myCity" text="Madrid"/>
        <mx:TextInput id="myCountry" text="Spain"/>
        <!-- Call the web service operation with a Button click. -->
        <mx:Button width="60" label="Get Weather"
                  click="WeatherService.GetWeather.send();"/>
        <!-- Display the Weather -->
        <mx:Label text="Weather:"/>
        <mx:TextArea text="{WeatherService.GetWeather.lastResult}" height="200"/>
    </mx:Application>

    The WSDL says GetWeatherResponse is a string, and it appears to be a string of XML, so set <mx:operation resultFormat="object"> as this will unwrap the SOAP response value and leave a string typed value intact. You can then create a new ActionScript 3.0 E4X-based XML instance from the unwrapped string:
        var myXML:XML = new XML(event.result.toString());
    You can then travese the XML document using E4X syntax, a simple example is included below:
        trace(myXML..Location);
        trace(myXML..Temperature);

  • Unable to map actionscripting with java nested objects

    Hi Experts...,
    Im a newbie in flex and actionscripting.....
    Im unable to map nested java classes and objects with my front end flex application using actionscript....I have searched everywhere almost to my knowledge on the net but failed to find a fix...,
    im having serious trouble reffereing to attributes of an object using another object( which by the way happens to be the parent object).
    Im using hibernate and springs to do the DB transactions....,
    Please help me out with this issue.....
    Thanks for all the help and support in advance....

    Again, I don't work with Java and you should ask Java-related question in Flex (or Java) forum.
    Java or not - you need to package your server side language specific object into something that AS understands (text, XML, AMF object) and load this data into AS via, perhaps, URLLoader. Or you can open socket. Then you parse this data with AS3 code in SWF.

  • Actionscript 3 and PHP

    I'm trying to learn how to communicate between PHP and Flash and have run into a problem.  The PHP file loads albums and artists from a database.  I can get the PHP file to load okay, but I cannot access a certain variable from the PHP file.  Here is the PHP I am using:
    <?php
    $dbName = "database";
    $place = "localhost";
    $username = "username";
    $password = "password";
    $link = mysql_connect ($place, $username, $password);
    mysql_select_db($dbName, $link);
    $genreID = 4;
    $query = "SELECT g.name, a.artist, a.albumName";
    $query .= " FROM albums a, genre g";
    $query .= " WHERE a.genreID=g.id";
    $query .= " AND g.id=" . $genreID;
    $result = mysql_query($query);
    $response = "resp=loaded\n";
    $index = 0;
    while ($row = mysql_fetch_array($result)) {
         $response .= " artist " . " = " . $row['artist'];
         $response .= " album " . " = " . $row['albumName'];
         $response .= " genre " . " = " . $row['name']. "\n";
         $index++;
    $response .= "total= ".$index;
    echo $response;
    ?>
    The variable I am trying to trace in Flash from the PHP file is 'total'.  Here is the actionscript I am using:
    package
         import flash.display.*;
         import flash.net.*;
         import flash.events.*;
         import flash.text.TextField;
         public class Albums extends MovieClip
              var phpFile:String = "http://localhost/getAlbums.php";
              var displayText:TextField = new TextField();
              public function Albums()
                   // constructor code
                   var urlRequest:URLRequest = new URLRequest(phpFile);
                   var urlLoader:URLLoader = new URLLoader();
                   urlLoader.addEventListener(Event.COMPLETE, callServerHandler, false, 0, true);
                   urlLoader.load(urlRequest);
                   if (urlLoader)
                        trace("loaded url");
                   else
                        trace("error loading url");
              function callServerHandler(evt:Event):void
                   var loader:URLLoader = URLLoader(evt.target);
                   var dataObj:URLVariables = new URLVariables(loader.data);
                   trace ("Total Albums "+dataObj.total);
    When I trace this in the output window I get 'Total Albums undefined'.  Why would this be?   Also if I just trace 'trace ("Total Albums " +dataObj.total);' Then I get the information from the php file but where there should be spaces inbetween the information I get '%20',  how can I remove those?
    Thanks for any information offered.
    Ben.

    You might consider taking what is probably considered a more standard approach for interacting with a database, where you have the PHP file echo the output in XML format and have Flash  take care of parsing the XML. That way, the total can be determined by the size of the data that you collect as an array and you don't need to have PHP provide it... though you still could.
    I'd like to point you to a good AS3 tutorial for this, but I haven't found one (doesn't mean there isn't... you could try searching Google using "AS3 XML PHP tutorial").  When I started down this road I used an AS2 tutorial (http://www.gotoandlearn.com/play.php?id=20 ) to get the overall concept under my belt and followed up with an AS3 XML tutorial to deal with the different way than how AS2 processes XML.

Maybe you are looking for

  • HT1386 My laptop no longer recognises my iPod

    Using the original cable, my iPod Touch does not seem to be recognised any more by my laptop. I have tried another iPod cable to eliminate the possibioity that the cable is damaged. This iPod is only 5 months old ans has not sustained any physical da

  • Zone Alarm In Xp

    Hi Guys A little enquiry as i am a little worried about something.I was on the net and my zone alarm firewall came up with a pop up message which i must of said yes to.When i looked at the listing of all the access denied etc, i noticed there was (DL

  • Error 37 with serial port / no with hyperterminal

    I have added to my Pc a card with two serial port, I can access to them by hyperteminal or by labview but only at port 0 and 1 at the same time or 2 and 3, if not I have an error 37. What can I do?

  • I need help restoring data from my time machine.

    1)  On the time machine, where do I find the TRASH file that is located on the dock in my desktop?  I'd like to restore that to a prior date but can't find it. 2)   I DID A VERY BAD THING & need help to get back to where I was before.   I wanted to d

  • NoSuchProviderException

              I am getting the following error when I am trying to send           messages using Transport.send(msg)           javax.mail.NoSuchProviderException: No provider for Address           type:rfc822           at javax.mail.Session.getTransport(