Using PHP Data Services to create an object and accessing that objects data in an unbound way in AS

Hello,
I've been able to use the php data services and bind the results of a function to a component. However I am having a hard time figuring out the syntax to use the data services to create an object out of the results, and then use that object as an array of filenames to provide the current index of the filename to a new sound object.
My problem is obviously in not being able to figure out the specific syntax, I have declared the service and and object of the services returned type and in the creationComplete() function I have assigned object.token = service.getData();
I've tried various ways of then pulling that data out of the object, with no success.
Can someone point me in the right direction?
This code probably looks horrible because it doesn't work yet.
- Joel
            import flash.media.Sound;
            import flash.media.SoundChannel;
            import mx.controls.Alert;
            var playing:Sound = new Sound();
            var channel:SoundChannel = new SoundChannel();
            var sndIndex:int=0;
            var skpTr:String;
            public function init():void{
             mp3Array.token = mp3service.getData();
             currentTrack(mp3Array.lastResult.filename); 
                 trace(mp3Array.lastResult.filename[sndIndex]);
            public function currentTrack(t:String):void{
                playing = new Sound();
                playing.load(new URLRequest("mp3/" +t));
            public function skip():void{
                stop();
                if (sndIndex != mp3Array.lastResult.length-1){
                    sndIndex++;
                    var skipTr:String=mp3Array.lastResult.filename[sndIndex].data;
                    currentTrack(skipTr);
                    play();
                } else {
                    sndIndex=0;
                    skipTr=mp3Array.lastResult.filename[sndIndex].data;
                    currentTrack(skipTr);
                    play();
            public function stop():void{
                channel.stop();
            public function play():void{
                channel = playing.play();
    <fx:Declarations>
        <s:CallResponder id="mp3Array"/>
        <mp3services:Mp3Service id="mp3service" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>

Hello Joel;
In retrieving your data - what is your php returning to FB, an object, object array, an array?  Either way, I have a brief example below that an object(s) is being returned.  Pull the data from the lastResult in a ResultEvent.  The object instantiated in the resultEvent will contain your data and you can do what you want from there. 
Also, I always use Network Monitor to see what data (if any) is being returned from the server, you can also see how it is being sent back.
John
private function init():void
     mp3Array.token = mp3service.getData();
     mp3Array.addEventListener(FaultEvent.FAULT, faultHandler);
     mp3Array.addEventListener(ResultEvent.RESULT, mp3Array_resultHandler);
protected function faultHandler(event:FaultEvent):void
     Alert.show("There was a fault error!" + event.message, "Fault Error", Alert.OK);
protected function mp3Array_resultHandler(event:ResultEvent):void
     // Not sure if your service is sending back an object or an array or ?
    var info:Object = mp3Array.lastResult;
     doSomeFunction(info)
protected function doSomeFunction(data:Object):void
     trace(info.filename);

Similar Messages

  • Creating remote objects and passing the retrieved data to modules

    I found at this Adobe tutorial a nice "RemoteService" class that  creates a RemoteObject and contains the functions for handling the  result and fault events. If I wanted to use this approach, how could I  pass the data from the result handler to interfaces that modules from  the main application could use?
    I could put the RemoteService/RemoteObject in the modules, but (in my  opinion- and I could be wrong) the best design seems to be using the  remote calls in the main app and passing the data along to the modules.
    Ultimately, I would like to know what the "best practices" are for creating remote objects and passing the retrieved data to modules
    Thanks!

    public void mouseClicked(MouseEvent e) {
      X x = new X(e.getX(), e.getY());
    }I don't see the difficulty.

  • How to use the same services-config for the local and remote servers.

    My flex project works fine using the below but when I upload my flash file to the server I doesn't work, all the relative paths and files are the same execpt the remote one is a linux server.
    <?xml version="1.0" encoding="UTF-8"?>
    <services-config>
        <services>
            <service id="amfphp-flashremoting-service"
                class="flex.messaging.services.RemotingService"
                messageTypes="flex.messaging.messages.RemotingMessage">
                <destination id="amfphp">
                    <channels>
                        <channel ref="my-amfphp"/>
                    </channels>
                    <properties>
                        <source>*</source>
                    </properties>
                </destination>
            </service>
        </services>
        <channels>
        <channel-definition id="my-amfphp" class="mx.messaging.channels.AMFChannel">
            <endpoint uri="http://localhost/domainn.org/amfphp/gateway.php" class="flex.messaging.endpoints.AMFEndpoint"/>
        </channel-definition>
        </channels>
    </services-config>
    I think the problem  is the line
            <endpoint uri="http://localhost/domainn.org/amfphp/gateway.php" class="flex.messaging.endpoints.AMFEndpoint"/>
    but I'm not sure how to use the same services-config for the local and remote servers.

    paul.williams wrote:
    You are confusing "served from a web-server" with "compiled on a web-server". Served from a web-server means you are downloading a file from the web-server, it does not necessarily mean that the files has been generated / compiled on the server.
    The server.name and server.port tokens are replaced at runtime (ie. on the client when the swf has been downloaded and is running) not compile time (ie. while mxmlc / ant / wet-tier compiler is running). You do not need to compile on the server to take advantage of this.
    Hi Paul,
    In Flex, there is feature that lets developer to put all service-config.xml file configuration information into swf file. with
    -services=path/to/services-config.xml
    IF
    services-config.xml
    have tokens in it and user have not specified additional
    -context-root
    and this swf file is not served from web-app-server (like tomcat for example) than it will not work,
    Flash player have no possible way to replace token values of service-config.xml file durring runtime if that service-config.xml file have been baked into swf file during compilation,
    for example during development you can launch your swf file from your browser with file// protocol and still be able to access blazeDS services if
    -services=path/to/services-config.xml
    have been specified durring compilation.
    I dont know any better way to exmplain this, but in summary there is two places that you can tell swf  about service confogiration,
    1) pass -services=path/to/services-config.xml  parameter to compiler this way you tell swf file up front about all that good stuff,
    or 2) you put that file on the webserver( in this case, yes you should have replacement tokens in that file) and they will be repaced at runtime .

  • I created an application and in  that application if date is changed the application starts from splash screen on re-entering and if date is not changed and u re-enters the application then it open in page where u leaved.Not working in USA timezone.

    I created an application and in  that application if date is changed the application starts from splash screen on re-entering and if date is not changed and u re-enters the application then it open in page where u leaved.It works fine in our side (Timezone,kolkata ,india even for Timezone,slvaniya,USA) but our USA client is telling that on changing the date it not starts from start-up sequence.Can anyone plz suggest the reason for it.

    This is the code which we have used.
    //////////Return if it is first time for the day or not//////////////
    + (BOOL)isFirstTimeToday {
    BOOL result = YES;
    NSDate *now = [[NSDate alloc] init];     /// represents the current time
    NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
    NSDateComponents *components = [gregorian components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit) fromDate: now];
    NSDate *today = [gregorian dateFromComponents:components];
    [now release];
    [gregorian release];
    NSDate *savedDate = [[NSUserDefaults standardUserDefaults] objectForKey:LAST_TIME_VISITED];
    if (savedDate) {
    if ([today earlierDate:savedDate] == today) {
    result = NO;
    return result;
    ////////Stores the date/////////////
    + (void)userDidVisitReenforceScreenToday {
    [[NSUserDefaults standardUserDefaults] setObject:[NSDate todayAtMidnight] forKey:LAST_TIME_VISITED];
    ////////////What [NSDate todayAtMidnight] stores/////////////////////
    + (NSDate *)daysFromNowAtMidnight:(NSInteger)nOfDays {
    NSDate *date = [NSDate dateWithTimeIntervalSinceNow: (86400*nOfDays)];
    NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
    NSDateComponents *components = [gregorian components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit) fromDate: date];
    NSDate *dateAtMidnight = [gregorian dateFromComponents:components];
    [gregorian release];
    NSLog(@"dateAtMidnight : %@",dateAtMidnight);
    return dateAtMidnight;
    + (NSDate *)todayAtMidnight {
    return [self daysFromNowAtMidnight:0];
    Please Suggest..

  • Where we can use standard ODS Object and Trasactional ODS Object ?

    Where we can use standard ODS Object and Trasactional ODS Object ?

    Hi,
    In a standard ODS object, data is stored in different versions (active, delta, modified), whereas a transactional ODS object contains the data in a single version.  Therefore, data is stored in precisely the same form in which it was written to the transactional ODS object by the application. In BW, you can use a transaction ODS object as a data target for an analysis process. The transactional ODS object is also required by diverse applications, such as SAP Strategic Enterprise Management (SEM) for example, as well as other external applications.Transactional ODS objects allow data to be available quickly. The data from this kind of ODS object is accessed transactionally, that is, data is written to the ODS object (possibly by several users at the same time) and reread as soon as possible.
    It offers no replacement for the standard ODS object. Instead, an additional function displays those that can be used for special applications.
    Regards,
    R.Ravi

  • Lost my iP 3G - How do I use iP 2G until iP 4 is here and keep all my data?

    Lost my iP 3G - How do I use iP 2G until iP 4 is here and keep all my data?
    Ok so this is a bit complicated - I left my iPhone 3G in a cab last weekend and unfortunately it's lost for good. I still have my original iPhone 2G and have already went to AT&T for a new Sim Card. I want to use the old phone until the iPhone 4 is out in 2 weeks..... My question is how do I Restore/Back Up/Sync the old iPhone so I can retrieve all the information from my lost 3G and not lose any of the data. I know a lot of the newest software (3.1.3) is not supported on the old iPhone. In addition, how do I make sure that I am able to transfer all the origninal data from my lost 3G, as well as all the new data that I acquire on the iPhone 2G i'm using now onto the new iPhone 4 when I get one in a few weeks???
    Very confusing I know, I just want to make sure all my data is safe and I don't make a blockheaded mistake of erasing some or any of it.....
    Thanks to all you iPhone geniuses out there willing to provide feedback!!!

    Well thank you for knowing the Terms of Use like it was your job Mr. Ian Parkinson. Forgive me for being the only person ever to sign up on here that simply clicked through to agree to terms without reading everything line by line. Yes I have only a handful of posts, I simply had a single question that I assumed would be answered quickly if I posted it into similar categories. It's too bad I couldn't have consulted with you first, the All Knowing and All Great Oz who has memorized the entire Terms of Use and has 6,000 posts on here..... I am simply not worthy in your presence, please strike me down with a fireballs from your eyes and bolts of lightning from your arse!

  • I created an application and in  that application if date is changed the application starts from splash screen on re-entering and if date is not changed and u re-enters the application then it open in page where u leaved.It works with iPod not with iPhone

    I created an application and in  that application if date is changed the application starts from splash screen on re-entering and if date is not changed and u re-enters the application then it open in page where u leaved.It works with iPod not with iPhone

    Try posting in the developer forums to see if you can get some assistance,you'll have to be a registered developer for access though.
    developer.apple.com

  • I can't change my Desktop Background anymore, Used The Diptic app to create a collage and now i cannot change my desktop picture,  on Mac Book pro

    I can't change my Desktop Background anymore, Used The Diptic app to create a collage and now i cannot change my desktop picture,  on Mac Book pro

    You can't go to System Preferences>Desktop&Screen Savers and change the display? Try it and see. I've never seen that problem.
    Clinton

  • SharePoint PPS 2013 Dashboard Designer error "Please check the data source for any unsaved changes and click on Test Data Source button"

    Hi,
    I am getting below error in SharePoint PPS 2013 Dashboard Designer. While create the Analysis Service by using "PROVIDER="MSOLAP";DATA SOURCE="http://testpivot2013:9090/Source%20Documents/TestSSource.xlsx"
    "An error occurred connecting to this data source. Please check the data source for any unsaved changes and click on Test Data Source button to confirm connection to the data source. "
    I have checked all the Sites and done all the steps also. But still getting the error.Its frustrating like anything. Everything is configured correctly but still getting this error.
    Thanks in advance.
    Poomani Sankaran

    Hi Poomani,
    Thanks for posting your issue,
    you must have to Install SQL Server 2012 ADOMD.Net  on your machine and find the browse the below mentioned URL to create SharePoint Dashboard with Analysis service step by step.
    http://www.c-sharpcorner.com/UploadFile/a9d961/create-an-analysis-service-data-source-connection-using-shar/
    I hope this is helpful to you, mark it as Helpful.
    If this works, Please mark it as Answered.
    Regards,
    Dharmendra Singh (MCPD-EA | MCTS)
    Blog : http://sharepoint-community.net/profile/DharmendraSingh

  • What's the difference between a not-initialed object and a null object

    hi guys, i wanna know the difference between a not-initialed object and a null object.
    for eg.
    Car c1;
    Car c2 = null;after the 2 lines , 2 Car obj-referance have been created, but no Car obj.
    1.so c2 is not refering to any object, so where do we put the null?in the heap?
    2.as no c2 is not refering to any object, what's the difference between c2 and c1?
    3.and where we store the difference-information?in the heap?

    For local variables you can't have "Car c1;" the compiler will complain.That's not true. It will only complain if you try to use it without initializing it.
    You can have (never used, so compiler doesn't care):
    public void doSomething()
       Car c1;
       System.out.println("Hello");
    }or you can have (definitely initialized, so doesn't have to be initialized where declared):
    public void doSomething(boolean goldClubMember)
       Car c1;
       if (goldClubMember)
           c1 = new Car("Lexus");
       else
           c1 = new Car("Kia");
       System.out.println("You can rent a " + c1.getMake());
    }

  • SAP Business Objects and SAP Business Objects PCM

    Hi all
    We want to know if is recommendable to have Business Objects and SAP Business Objects PCM installed in the same server, and if is necessary to have a special configuration of the services for both applications?
    Thanks in advance

    Hi,
    You can refer the below link for PCM Install guide:
    http://service.sap.com/~sapidb/011000358700000225772009E/FPM75_PCM_InstallGuide_en.pdf
    If you are looking for more info related to specific requirements then from the below link select BusinessObjects tab and select PCM category for more guides.
    http://help.sap.com
    -Noor.

  • Level 00 object and level 01 object for character

    Hello Gurus,
           for universe based on sap bi query,  what is level 00 object and level 01 object for character? and how to use them, will yo please give a simple example?
    Many thanks.

    Hi,
    To complete the previous answer, L00 is the level that contains "All" members for a given characteristic.
    Whe nit is a hierarchy or a structure the L00 level contains members.
    So to summarize L00 is not very useful to be used in a query when you are using a characteristic but you may have to use it when it is a hierarchy or a structure: it depends of the query selection of course.
    Didier

  • How do you export your movie using idvd? I keep getting error messages and notices that I do not have enough space to transfer to a dvd.

    How do you export your movie using idvd? I keep getting error messages and notices that I do not have enough space to transfer to a dvd.

    Can you give us the steps to re-create the problem, and the exact wording of the error message you are getting please.

  • ABAP proxy object and JAVA proxy objects

    can anyone explain whether ABAP proxy object and JAVA proxy objects can communicate with each others?
    if yes then how???

    JCO connectors would be able to do the trick here i guess
    regards
    krishna

  • Current objectives and next yearu2019s objectives in one appraisal document

    I keep coming across the requirement for an employee to be able to record comments and scores for his/her current objectives and at the same time to document his/her objectives for the next year in the same appraisal document. The SAP standard process being to record last yearu2019s objectives and next years objectives in two separate documents.
    Has anyone else come across this requirement and if so how did you meet it?
    Is there a BAdI which will pull the u2018Performance Objectives for the next 12 monthsu2019 from the 2010 appraisal document into the 2011 appraisal document?
    Any suggestions would be much appreciated.

    Hi,
    Please check the following discussion:
    Re: Performance Appraisal-Copy the "Completed" Appraisal for next year
    Credits: SDN members
    Hope this helps.
    Donnie

Maybe you are looking for