473,474 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

ActionScript, Alfresco and callbacks

16 New Member
I need further help in understanding how callbacks work with Alfresco.

I am able to connect to alfresco and I’m trying to return a list of users from three groups, but it seems that I don’t quite understand how callbacks work, because it’s returning all three groups to my function at once, rather than having the function return the result of each set of users from their respective groups.

Expand|Select|Wrap|Line Numbers
  1.             // returns Group[]
  2.             public function EditUser_GetUserGroups() : Array
  3.             {
  4.                   var wsl : WebScriptLoader = WebScriptLoader.Load(
  5.                         "service/d3/person/groups",
  6.                         {
  7.                               alf_method: "GET",
  8.                               alf_ticket: alfrescoTicket,
  9.                               username: this.userName
  10.                         },
  11.                         after_getUserGroups
  12.                   );
  13.                   wsl.userCallback = pullHandler();
  14.  
  15.                   return undefined;
  16.             }
  17.  
  18.             private function after_getUserGroups(wsl : WebScriptLoader) : void
  19.             {
  20.                   wsl.userCallback(wsl.responseData.children());
  21.                   EditUser_GetUserGroup(wsl.responseData.children());
  22.             }
  23.  
  24.             public function EditUser_GetUserGroup(groupName) : Array
  25.             {
  26.                   groupName = gotUserGroups2(groupName);
  27.                   var wsl : WebScriptLoader = WebScriptLoader.Load(
  28.                         "service/d3/person/group",
  29.                         {
  30.                               alf_method: "GET",
  31.                               alf_ticket: alfrescoTicket,
  32.                               groupname: groupName
  33.                         },
  34.                         after_getUserFromGroup
  35.                   );
  36.                   wsl.userCallback = pullHandler();
  37.                   trace("groupName :"+groupName);
  38.                   return undefined;
  39.             }
  40.  
  41.             private function gotUserGroups2(x : XMLList ) : XMLListCollection
  42.             {
  43.                   var items : Array = [];
  44.  
  45.                   for each(var e : XML in x)
  46.                   {
  47.                         items.push("<group name='"+groupNameFunction2(e)+"'><users/></group>");
  48.                   }
  49.  
  50.             //    items[items.length] = "<groups>";
  51.  
  52.                   items.sort();
  53.  
  54.                   var myXml:String = "<groups>";
  55.  
  56.                   for(var a:int = 0; a<items.length; a++)
  57.                   {
  58.                         myXml += items[a];
  59.                   }
  60.                         //myXml = myXml.substring(4, myXml.length); 
  61.                         myXml += "</groups>"; 
  62.  
  63.                   //trace(myXml);                     
  64.                   var groupsXML:XML = new XML(myXml);
  65.                   //trace(groupsXML);
  66.  
  67.             var groupData:XMLListCollection = new XMLListCollection(groupsXML.group.@name);
  68.             return groupData;
  69.             }
  70.  
  71.             private function groupNameFunction2(item:Object):String
  72.             {
  73.                   var s : String = item.name;
  74.  
  75.                   s = s.replace("/sys:system/sys:authorities/", "");
  76.                   s = s.replace(new RegExp("usr:GROUP_", "g"), "");
  77.                   s = s.replace("/", " ");
  78.                   s=s.replace(new RegExp("_x\\d+_", "g"), " ");
  79.  
  80.                   return s;
  81.  
  82.             }
  83.  
  84.             private function after_getUserFromGroup(wsl : WebScriptLoader) :void
  85.             {
  86.                   var x : XMLList = wsl.responseData.children();
  87.  
  88.             //    var uifg : UserInfoFromGroups = new UserInfoFromGroups(x.userName[0].toString());
  89.  
  90.                   wsl.userCallback(x);    
  91.             }
  92.  
The trace for groupName returns: DevelopersGroup1TestGroup

How can I have the function process each group separately as Developers followed by Group1, then TestGroup?

Is there a way to delay a callback until it’s complete? I’ve tried ws1.onComplete.

Any suggestions would be helpful and thanx n advance
Oct 29 '08 #1
0 2028

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Christopher Jastram | last post by:
I'm a self-taught programmer, so this might be a pretty dumb question. If it is, please point me in the right direction and I shall apologize profusely. I have a question regarding C++ and...
0
by: Matt | last post by:
Hello, I am attempting to get a software prototype UI/demo built in Flash to talk with existing C++ (so I can exchange data and commands between the application-software already developed in the...
1
by: karin nguyen | last post by:
Hi, i am a new user for flash / actionscript. Now our lecturer asked us to do research for actionscript together with the flash file as example but I only can find the actionscript without flash...
1
by: itsthefocusman | last post by:
Hi everyone my name is Daniel, I would like some help. I am using Flash 8 to build a website. I have built the whole site within one flash movie by building the different sections of the site...
1
by: Adam Chapman | last post by:
Hello, I am trying to make an application with a flash interface which does calcultaions in the more powerful c++. Basically I want to be able to draw a shape in flash and do some structural...
1
by: Rocky86 | last post by:
hi ppl bascially I am require to pass my php coding to actionscript and the actionscript will seperate the code of my php how do I do it? Must I create a function for php to be pass into actionscript...
3
by: JuneNasch | last post by:
Hi. I'm a beginner in using Actionscript. Do you know what is the actionscript for a button to exit or quit my project? I'm using Flash 8 pro. I don't know which version of actionscript is used,...
0
by: gabrielk43 | last post by:
Hi I am new to Flex and I use Flex Builder 2 to make a web service client. So I have a web service in .NET(c#) with a simple web method that returns a string(no arguments). It works, I tested it...
2
by: mfsiddiq | last post by:
HI I am facing some problem with my as-js communication.I am passing a String expression to a javascript function using ExternalInterface.call function upon mouse click.My string expression is as...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.