AS3 Centering XML thumbnails in movieclip

Hi there, I have an xml thumbnails feed, which I want to center the amount of thumbnails loaded inside a movieclip (thumbstrip_mc).
The structure is a movie clip (gallerystrip_mc) with a mask inside it (984px wide), which has a movieclip inside it (thumbstrip_mc), which is 2300px wide to scroll the thumbnails. This then has a dynamic movieclip inside it (emptyClip), which has a child (imageLoader).
ImageLoader holds a thumbnail, and emptyClip is there so I can use buttonmode.
How can I tell it to center the thumbnails to the middle of thumbstrip_mc? Here is the code for loading the thumbnails.
// Load thumbnails
function xmlLoaded(event:Event):void
    xml = XML(event.target.data);
    xmlList = xml.children();
    for(var i:int = 0; i < xmlList.length(); i++)
        imageLoader = new Loader();
        imageLoader.load(new URLRequest(xmlList[i].attribute("thumb")));
        imageLoader.x = i * 110 + 10;
        imageLoader.y = 2;
        imageLoader.name = xmlList[i].attribute("source");
        var emptyClip:MovieClip = new MovieClip;
        emptyClip.name = "thumbHolder_mc" + i;
        gallerystrip_mc.thumbstrip_mc.addChild(emptyClip);
        emptyClip.addChild(imageLoader);
        emptyClip.buttonMode = true;
        emptyClip.x = 101;
        imageLoader.addEventListener(MouseEvent.CLICK, showPicture);

I just wanted to say that the above code works fine, I just need to add the resizing background code to it. Please help.  thanks

Similar Messages

  • AS3 and XML, HELP!

    Hi
    I have no idea where to post this, so pls forgive me if im in the wrong place, but I have an Assessment due tomorrow, I'm only 4 weeks knew to AS3 and Flash, and confused as, so pls forgive me if i also look silly asking this question.
    The issue is loading data from an XML file and having it present in a Flash website. Its a book review thing (i've altered the XML and AS3 for posting here so please bare that in mind), so the XML looks a little like this
    <books>
        <book>
            <bookName>The Monsters</bookName>
            <genres>
                <genre>Thriller</genre>
                <genre>Crime</genre>
                <genre>Comedy</genre>
            </genres>
            <description>about the mummies.</description>
            <image>mummies.jpg</image>
            <reviews>
                <review>
                    <date>16/07/2011</date>
                    <name>unnamed</name>
                    <info>
                        <rating>5</rating>
                        <why>blah blah</why>
                        <theGood>it was good...</theGood>
                        <the Bad>it was bad…</theBad>
                    </info>
                </review>
            </reviews>
        </book>
    <books>
    but each Book has multiple reviews, i've just shown you one. Anyway, i need to present this information in 3 dynamic text fields when a book is selected in my ComboBox… after a lot of trouble i got the basics of it. So in the Genre box the genres will display, and in the Description box the description will display, and in the Review box i can get all the information, but only with all the tags. I need it to display without any tags, it would be wonderful if i could figure out how i could put date, name etc in front of that information as well, but I cant even begin to figure that one out.  For the life of me i cannot figure it out. below is the code I have so far:
    //Load XML
    var booksXML:XML = new XML();
    var loader:URLLoader = new URLLoader();
    var request:URLRequest = new URLRequest("gigGuide.xml");
    loader.addEventListener(Event.COMPLETE,loaderOnComplete);
    loader.load(request);
    function loaderOnComplete(event:Event):void
       booksXML = new XML(event.target.data);
       var books:Array = new Array({label:"Select a Book"});
       for each (var book:XML in booksXML.band)
          books.push({label:book.bookName.toString(), data:book.description.toXMLString(),
                     infoLocal:book.genres.genre.toString(), infoDate:book.reviews.review.toString(),
                     infoImage:book.image});
       bandCB.dataProvider = new DataProvider(bands);
    //ComboBox changeable
    bookCB.addEventListener(Event.CHANGE, changeHandler2);
    function changeHandler2(event:Event):void
       genre_txt.text = ComboBox(event.target).selectedItem.infoLocal;
       description_txt.text = ComboBox(event.target).selectedItem.data;
       reviews_txt.text = ComboBox(event.target).selectedItem.infoDate;
       empty_mc.tex = ComboBox(event.target).selectedItem.infoImage; //doesn't work
    any help would be greatly appreciated, and the image doesn't work, i've already faced facts that im not going to get that one to work
    Thank you in advance

    From what I can see you have a few problems. In your loaderOnComplete you set the data provider with 'bands' but create a variable called 'books'.
    Also, you want to be using the XMLList object to parse your data out. It's much simpler.
    Have a look at the following:
    var booksXML:XML;
    function loaderOnComplete(e:Event):void
              booksXML = new XML(e.target.data);
              var books:XMLList = booksXML.book;
              trace(books[0].bookName);
              var bookReviews:XMLList = books[0].reviews.review;
              trace(bookReviews[0].name);
    trace(bookReviews[0].date);
    First we get all the book xml objects in an XML List - the trace traces book number 0's name - The Monsters.
    Next, you can get all the reviews for a book in another XML List. Here we use the first book - book[0] and trace out the review's name and date.
    You can iterate through an XMLList as it has a length() method - (not a length property)
    Also, loading an image for a book would be easy - you just grab the image property of the current book and then use a Loader to load it.
    trace(books[0].image);

  • Access XML array inside MovieClip. How ?!

    Hello,
    Ok, I have a code to load Multiple XML files at once and save it to an array named xmlDocs like this:
    //each xml file to load
    var xmlManifest:Array = new Array();
    //the xml for each file
    var xmlDocs:Array = new Array();
    //the xml file with all the xml files to be loaded.
    var RSSWidgetRequest:URLRequest = new URLRequest("xml/rss-widget.xml");
    var urlLoader:URLLoader = new URLLoader();
    var docsXML:XML = new XML();
    docsXML.ignoreWhitespace = true;
    //when COMPLETE is loaded run function loadDocs
    urlLoader.addEventListener(Event.COMPLETE,loadDocs);
    urlLoader.load(RSSWidgetRequest);
    //load the docs
    function loadDocs(event:Event):void {
    docsXML = XML(event.target.data);
    //m21m is the name space defined in my doc m21m:feed... you don't need one.
    var m21m:Namespace=docsXML.namespace("m21m");
    //get all the feed nodes
    var feeds=docsXML..m21m::feed;
    for (var i:int=0; i < feeds.length(); ++i) {
      //add the feed to the xmlManifest array
      xmlManifest[xmlManifest.length] = feeds[i].attribute("feed");
    //load the xml for each doc
    loadXMLDocs();
    //load all the XML files
    function loadXMLDocs() {
    if (xmlManifest.length>xmlDocs.length) {
      var RSSURL:URLRequest = new URLRequest(xmlManifest[xmlDocs.length]);
      var urlLoader:URLLoader = new URLLoader();
      var xmlDoc:XML = new XML();
      xmlDoc.ignoreWhitespace = true;
      urlLoader.addEventListener(Event.COMPLETE,getDoc);
      urlLoader.load(RSSURL);
      function getDoc(event:Event) {
       xmlDoc = XML(event.target.data);
       //hold all the xml of each doc in an array
       xmlDocs[xmlDocs.length] = xmlDoc;
       loadXMLDocs();
    } else {
      trace(xmlDocs)
      //do something when all xml is loaded
    How i can access xmlDocs array difinte on main timeline from insted MovieClip...?!
    Regards,

    It does not work. I used this code to display the data:
    var xmlList:XMLList;
    var xmlData:XML = new XML(MovieClip(this.parent.parent).xmlDocs[0].data);
    xmlList = xmlData.class10;
    sId10_btn.addEventListener(MouseEvent.CLICK, displayData);
    function displayData(evt:MouseEvent):void
              for each (var grade:XML in xmlList)
                        if (myTextField.text == grade.st_id.text())
                                  content10.sName10.text = grade.st_name;
                                  content10.sQuran10.text = grade.quran;
                                  content10.sIslamic10.text = grade.islamic;
                                  content10.sArabic10.text = grade.arabic;
                                  content10.sEnglish10.text = grade.english;
                                  content10.sMath10.text = grade.math;
                                  content10.sChemistry10.text = grade.chemistry;
                                  content10.sPhysics10.text = grade.physics;
                                  content10.sBiology10.text = grade.biology;
                                  content10.sSocial10.text = grade.social;
                                  content10.sSport10.text = grade.sport;
                                  content10.sComputer10.text = grade.computer;
                                  content10.sNesba10.text = roundNumber(Number(grade.nesba), 2);

  • AS3.0+XML+MP3  HELP!

    I want to use AS3.0 to add to carry the MP3 in the XML, also
    can show the song, see much data concerning this aspect, but can't
    read the contents in the XML.Hope everyone gives some help.
    My XML document is as follows:
    <?xml version="1.0" encoding="GB2312"?>
    <data>
    <song>
    <title>A DISTANCE THERE IS</title>
    <name>MySound00.mp3</name>
    </song>
    <song>
    <title>LOVE IN DECEMBER</title>
    <name>MySound000.mp3</name>
    </song>
    <song>
    <title>THANK YOU</title>
    <name>MySound.mp3</name>
    </song>
    </data>
    The result that wants to do is an address as follows:
    Click
    me!

    http://www.aihuahot.cn/

  • AS3 centering and resizing a background in existing code

    I have a code for a page I am using and I would like to add a background and have it resize with the screen like the rest of the page.  I have created a movie button named "pic" with the image in it but I don't know how to write the code and place it in the existing AS3 code file.  Could someone please help.  I am brand new to this so if someone could tell me how to place the code like i was in 3rd grade, that would be great. Here is the existing code.
    package com.modules
    import flash.display.*;
    import flash.events.*;
    import flash.net.*;
    import flash.text.*;
    import caurina.transitions.Tweener;
    import com.utils.*;
        public class About extends Sprite
    private var content_height:int;
    private var content_width:int;
    private var marginTop:int;
    private var marginBottom:int;
    private var content_y:int;
    private var _content:Content;
    private var news:News;
    private var array:Array;
    private var pan:Panning;
       public function About()
    // listen for when this is added to stage
    this.addEventListener(Event.ADDED_TO_STAGE, ini); 
    // listen for when this is removed from stage
    this.addEventListener(Event.REMOVED_FROM_STAGE, remove);
    private function ini(e:Event)
    stage.addEventListener(Event.ADDED, onStageResize);
    stage.addEventListener(Event.RESIZE, onStageResize);
    content_y = int(GlobalVarContainer.vars.CONTENT_Y);
    _content = new Content;
    addChild(_content);
    _content.visible=false;
    // load xml
    if((GlobalVarContainer.vars.XML_PATH!="") && (GlobalVarContainer.vars.XML_PATH!=undefined))
    var loadXml:LoadXml;
    loadXml = new LoadXml(GlobalVarContainer.vars.XML_PATH);
    loadXml.addEventListener(Event.COMPLETE, onXmlComplete);
    private function onXmlComplete(e:Event)
    // set up content
    content_width = e.target.returnData.attribute("width");
    marginTop = e.target.returnData.attribute("marginTop");
    marginBottom = e.target.returnData.attribute("marginBottom");
    var backgroundColor = e.target.returnData.attribute("backgroundColor");
    Tweener.addTween(_content.bg, {_color:backgroundColor, time:.1, transition:"linear"});
    _content.bg.width = content_width;
    _content.masc.area.width = (content_width -_content.masc.x)-20;
    _content.holder.txt.width = _content.masc.area.width -10;
    // write text
    _content.holder.txt.mouseWheelEnabled = false;
    _content.holder.txt.styleSheet = GlobalVarContainer.vars.CSS;
    _content.holder.txt.condenseWhite = true;
    _content.holder.txt.htmlText = e.target.returnData;
    _content.holder.txt.autoSize = TextFieldAutoSize.LEFT;
    onStageResize();
    _content.visible=true;
    // create new Panning instance;
    pan = new Panning(_content.holder, _content.masc, _content.bg, 4, true);
    pan.addEventListener(Event.ADDED, scInit);
    addChild(pan);
    // Initialize panning
    function scInit(e:Event):void
    pan.init();
    // resize contents
    private function onStageResize(e:Event = null):void
    resizeContent((stage.stageHeight - ((content_y + marginTop) + int(GlobalVarContainer.vars.BOTTOM_SHAPE_H)))-marginBottom);
    private function resizeContent(height_:int):void
    content_height = height_;
    _content.bg.height = content_height;
    _content.masc.area.height = (content_height -_content.masc.y)-20;
    _content.holder.mask = _content.masc;
    Tweener.addTween(_content, {x: Math.round(stage.stageWidth/2 - _content.width/2) , time:.5, transition:"linear"});
    _content.y=content_y+ marginTop;
    // used to change colors. here we not use
    public function changeTheme():void
    // remove listeners, images and unload panning;
    function remove(event: Event) : void
    pan.unload();
    stage.removeEventListener(Event.ADDED, onStageResize);
    stage.removeEventListener(Event.RESIZE, onStageResize);
    this.removeEventListener(Event.ADDED_TO_STAGE, ini); 
    this.removeEventListener(Event.REMOVED_FROM_STAGE, remove);
    trace("remove about");

    I just wanted to say that the above code works fine, I just need to add the resizing background code to it. Please help.  thanks

  • AS3 Help- Reloading a tween movieclip

    Hi everyone,
    I'm having the toughest time with my portfolio website. It's still pretty rough but getting there.
    Here is a link to the swf so you could see the problem and maybe help me fix it.
    http://tanyamendiola.com/pages/assets/flas/indexnew.swf
    Once you get to my portfolio menu homepage, click on Print design. Everything there loads fine.
    The trouble is going back to the portfolio movieclip and having it display those menu buttons again.
    As you can see, if you try to click the view portfolio button at the top, it loads that movieclip to wherever you left off at.
    Basically, my question is: How can I have my "view portfolio" button reload/refresh the movieclip (page1) from the beginning in my pagecontainer_mc?
    page1 is a movieclip that shows my portfolio buttons.
    page2 is a movieclip that show the "about me" section.
    pagecontainer_mc is an empty movieclip that loads page1 or page2.
    import fl.transitions.*;
    import fl.transitions.easing.*;
    var p1=new page1;
    var p2=new page2;
    pagecontainer_mc.addChild(p1);
    var pageMoveTween:Tween=new Tween(pagecontainer_mc,"alpha",Strong.easeOut,0,1,2,true);
    mainmenu_mc.portfolio_btn.addEventListener(MouseEvent.CLICK,portCLICK);
    mainmenu_mc.aboutme_btn.addEventListener(MouseEvent.CLICK,aboutCLICK);
    function portCLICK(event:MouseEvent):void{
         p1.gotoAndStop(0);
         var btn1Outro:Tween=new Tween(pagecontainer_mc, "alpha",Strong.easeOut,1,0,1,true);
         btn1Outro.addEventListener(TweenEvent.MOTION_FINISH, runBtn1Transition);
         function runBtn1Transition(event:TweenEvent):void{
              pagecontainer_mc.removeChildAt(0);
              pagecontainer_mc.addChild(p1);
              var btn1Intro:Tween=new Tween(pagecontainer_mc,"alpha",Strong.easeOut,0,1,1,true);
    function aboutCLICK(event:MouseEvent):void{
         var btn2Outro:Tween=new Tween(pagecontainer_mc,"alpha",Strong.easeOut,1,0,1,true);
         btn2Outro.addEventListener(TweenEvent.MOTION_FINISH, runBtn2Transition);
         function runBtn2Transition(event:TweenEvent):void{
              pagecontainer_mc.removeChildAt(0);
              pagecontainer_mc.addChild(p2);
              var btn2Intro:Tween=new Tween(pagecontainer_mc,"alpha",Strong.easeOut,0,1,1,true);

    I've figured out the problem! (After spending several days looking for the right code and trying different angles.)
    I followed the coding off of this tutorial (http://www.demetri-media.com/FlashTalker/ExternalSWFCommunication.html) and took a specific feature (the cyan ball) and applied it to my file. It works perfectly now! Thank you for your help.
    Here's how I did it. The back button from within the loaded swf closes pefectly. Now I can move on to putting my portfolio together.
    If you have time and would like to help me, how would I/where would I place a loader to this to show how much of the swf file has been loaded/is being loaded? My swfs are pretty big files. I'm still pretty new to AS3.
    var myCLip:MovieClip = root as MovieClip;
    var container_mc:MovieClip;
    var myLoader:Loader = new Loader();
    myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderCompletedHandler);
    function loaderCompletedHandler(evt:Event):void { container_mc = myLoader.content as MovieClip;
    container_mc.back_btn.addEventListener(MouseEvent.CLICK, extCommunicate);
    function extCommunicate(evt:MouseEvent):void{
    container_mc.back_btn.alpha=.25; removeChild(myLoader);}
    var loadPRINT:String = "print.swf";
    var urlPRINT:URLRequest = new URLRequest(loadPRINT);
    printdesign_btn.addEventListener(MouseEvent.CLICK, swfLoads);
    function swfLoads(evt:MouseEvent):void {
    addChild(myLoader);
    myLoader.load(urlPRINT);
    var loadIDENTITY:String = "identity.swf";
    var urlIDENTITY:URLRequest = new URLRequest(loadIDENTITY);
    identity_btn.addEventListener(MouseEvent.CLICK, swfLoads);
    function swfLoads(evt:MouseEvent):void {
    addChild(myLoader);
    myLoader.load(urlIDENTITY);
    var loadPACK:String = "packaging.swf";
    var urlPACK:URLRequest = new URLRequest(loadPACK);
    pack_btn.addEventListener(MouseEvent.CLICK, swfLoads);
    function swfLoads(evt:MouseEvent):void {
    addChild(myLoader);
    myLoader.load(urlPCK);
    var loadWEB:String = "webdesign.swf";
    var urlWEB:URLRequest = new URLRequest(loadWEB);
    web_btn.addEventListener(MouseEvent.CLICK, swfLoads);
    function swfLoads(evt:MouseEvent):void {
    addChild(myLoader);
    myLoader.load(urlWEB);
    var loadPHOTO:String = "photography.swf";
    var urlPHOTO:URLRequest = new URLRequest(loadPHOTO);
    photo_btn.addEventListener(MouseEvent.CLICK, swfLoads);
    function swfLoads(evt:MouseEvent):void {
    addChild(myLoader);
    myLoader.load(urlPHOTO);

  • Load images from XML to specific movieclip

    I'm still begginer. I have to load images in specific movieclip, because they're loading over all the other layers. What should I do?
    I made a simple slideshow by tutorial.
    I guess it would be better that I show all the code not specific parts:
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    import fl.transitions.TweenEvent;
    var my_speed:Number;
    var my_total:Number;
    var my_images:XMLList;
    var my_loaders_array:Array=[];
    var my_labels_array:Array=[];
    var my_success_counter:Number=0;
    var my_playback_counter:Number=0;
    var my_slideshow:Sprite = new Sprite();
    var my_image_slides:Sprite = new Sprite();
    var my_label_slides:Sprite = new Sprite();
    var my_preloader:TextField;
    var my_timer:Timer;
    var my_prev_tween:Tween;
    var my_tweens_array:Array=[];
    var my_xml_loader:URLLoader = new URLLoader();
    my_xml_loader.load(new URLRequest("sshow.xml"));
    my_xml_loader.addEventListener(Event.COMPLETE, processXML);
    function processXML(e:Event):void {
        var my_xml:XML=new XML(e.target.data);
        my_speed=my_xml.@SPEED;
        my_images=my_xml.IMAGE;
        my_total=my_images.length();
        loadImages();
        my_xml_loader.removeEventListener(Event.COMPLETE, processXML);
        my_xml_loader=null;
    function loadImages():void {
        for (var i:Number = 0; i < my_total; i++) {
            var my_url:String=my_images[i].@URL;
            var my_loader:Loader = new Loader();
            my_loader.load(new URLRequest(my_url));
            my_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
            my_loaders_array.push(my_loader);
        my_preloader = new TextField();
        my_preloader.text="Loading";
        my_preloader.autoSize=TextFieldAutoSize.CENTER;
        my_preloader.x = (stage.stageWidth - my_preloader.width)/2;
        my_preloader.y = (stage.stageHeight - my_preloader.height)/2;
        addChild(my_preloader);
    function onComplete(e:Event):void {
        my_success_counter++;
        if (my_success_counter==my_total) {
            startShow();
        var my_loaderInfo:LoaderInfo=LoaderInfo(e.target);
        my_loaderInfo.removeEventListener(Event.COMPLETE, onComplete);
    function startShow():void {
        removeChild(my_preloader);
        my_preloader=null;
        addChild(my_slideshow);
        my_slideshow.addChild(my_image_slides);
        nextImage();
        my_timer=new Timer(my_speed*1000);
        my_timer.addEventListener(TimerEvent.TIMER, timerListener);
        my_timer.start();
    function nextImage():void {
        var my_image:Loader=Loader(my_loaders_array[my_playback_counter]);
        my_image_slides.addChild(my_image);
        my_image.x = (stage.stageWidth - my_image.width)/2;
        my_image.y = (stage.stageHeight - my_image.height-20)/2;
        my_tweens_array[0]=new Tween(my_image,"alpha",Strong.easeOut,0,1,2,true);
    function timerListener(e:TimerEvent):void {
        hidePrev();
        my_playback_counter++;
        if (my_playback_counter==my_total) {
            my_playback_counter=0;
        nextImage();
    function hidePrev():void {
        var my_image:Loader=Loader(my_image_slides.getChildAt(0));
        my_prev_tween=new Tween(my_image,"alpha",Strong.easeOut,1,0,2,true);
        my_prev_tween.addEventListener(TweenEvent.MOTION_FINISH, onFadeOut);
    function onFadeOut(e:TweenEvent):void {
        my_image_slides.removeChildAt(0);

    I don't see a problem in the code you provided. All the pictures are put in single one MovieClip, my_image_slides. Of course, there can be only one DisplayObject in a DisplayObjectContainer's layer (depth), so when you call function addChild again and again, the child displayObjects keep stacking up one on the other. I found one strange thing though:
    my_tweens_array[0]=new Tween(my_image,"alpha",Strong.easeOut,0,1,2,true);
    Why would you create an array just to limit it to one item and overwrite it every time? I would use this instead:
    my_tweens_array.push(new Tween(my_image,"alpha",Strong.easeOut,0,1,2,true));
    Can you upload it somwhere so we can see it in action? At this point I can only guess what the problem is.

  • XML Thumbnail Photo gallery

    Hi, I'm almost done with this Photo Gallery project but I
    have one final issue with the photo gallery. I created a
    multidimensional array to group image paths from the XML file in
    sets of 9. When the array is called the images appear in the right
    order, but when the images are rendered in their respective movie
    clips dynamically they appear in reverse order. Why would this be
    happening? I don't want to use the array.reverse() method because
    it would complicate my code unnecessarily when I add forward and
    back buttons to navigate throught the different sets. Any help
    would be greatly appreciated.
    Thanks!

    From the help docs:
    The MovieClipLoader.onLoadInit handler is invoked after the
    actions in the first frame of the clip have executed, so you can
    begin manipulating the loaded clip.
    The problem is the way the onLoadInit function fires. Since
    it doesn't fire until after the onLoadComplete method, you have a
    call stack of 9 onLoadInits waiting to fire. Since it uses a stack
    structure, your data is handled in a first-in-last-out format,
    hence, the first image in is the last image out.
    You can fix the behaviour by changing onLoadInit to
    onLoadStart.
    Cheers,
    FlashTastic

  • AS3 Playback control of nested movieclips

    Hey all,
    I'm trying to figure out how to control a movieclip symbol from the timeline.
    I've created a Main Timeline with one symbol per frame, a labels layer and an action layer.
    Each frame has its own label, and each action keyframe has a listener attached to the current symbol like so:
    symb = title_mc;
    symb.cacheAsBitmap = true;
    symb.mask = f_mask;
    symb.focusRect = false;
    stage.focus = symb;
    symb.addEventListener(KeyboardEvent.KEY_DOWN, mc_pager);
    I need the following structure:
    From Main timeline Frame
    Identify symbol instance (labeled as <name>_mc)
    Inside symbol timeline, play from first frame (labeled '0') until next labeled frame ('1' and so on)
    stop and wait for next pg_down to start playing from next labeled frame to the following (i.e. '1'-'2'), or pg_up to start playing from the previous labeled frame (i.e. '0' - '1')
    on last frame (labeled 'final') exit symbol focus and return keyboard control to main timeline to allow pg_down and pg_up to move to the next / previous frame. on pg_up on symbol.currentFrame == 0, do same.
    This is the code I'm currently stuck with:
    import flash.events.Event;
    import flash.display.MovieClip;
    import flash.events.KeyboardEvent;
    stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
    stop();
    f_mask.cacheAsBitmap = true;
    var symb:MovieClip;
    symb = MovieClip(root); //assign symbol I want to be controlled by pg_up/pg_down
    symb.focusRect = false;
    symb.addEventListener(KeyboardEvent.KEY_DOWN, mc_pager);  //add keyboard event listener
    stage.focus = symb; //focus on current symbol
    function mc_pager(e:KeyboardEvent):void{
        var myKey = e.keyCode;
        if (myKey == Keyboard.PAGE_DOWN){
            do{
                symb.play(); // it plays, then checks if the lbl is null or final, then quits
                trace("current: " + symb.currentFrameLabel);
            } while (symb.currentFrameLabel == null && symb.currentFrameLabel != 'final');
            symb.stop();
            symb.removeEventListener(KeyboardEvent.KEY_DOWN, mc_pager);
            stage.focus=MovieClip(root); //return focus to main timeline (in the next keyframes, the focus is on the nested _mc
        if (myKey == Keyboard.PAGE_UP){
            do{
                symb.prevFrame();
            } while (symb.currentFrameLabel == null && symb.currentFrameLabel != '0');
            symb.stop();
            symb.removeEventListener(KeyboardEvent.KEY_DOWN, mc_pager);
            stage.focus=MovieClip(root);
    So far, I've tried several different things (including multiple eventhandlers) to no avail. This is what looks best so far, being logically sound (I think). But it doesn't work. Please, I need a hand with this.

    use:
    function mc_pager(e:KeyboardEvent):void{
        var myKey = e.keyCode;
        if (myKey == Keyboard.PAGE_DOWN){
    symb.removeEventListener(KeyboardEvent.KEY_DOWN, mc_pager);
                symb.play(); // it plays, then checks if the lbl is null or final, then quits
                trace("current: " + symb.currentFrameLabel);
                 symb.addEventListener(Event.ENTER_FRAME,checkNextFrameF);
        if (myKey == Keyboard.PAGE_UP){
           symb.addEventListener(Event.ENTER_FRAME,checkPrevFrameF);
    function checkNextFrameF(e:Event):void{
    if(i don't know what you want to check here || symb.currentFrame==symb.totalFrames);
            symb.stop();
    symb.removeEventListener(Event.ENTER_FRAME,checkNextFrameF);
    symb.addEventListener(KeyboardEvent.KEY_DOWN, mc_pager);
    whatever else
    function checkPrevFrameF(e:Event):void{
    symb.prevFrame();
    if(i don't konw what you want to check here || symb.currentFrame==1){
    symb.removeEventListener(Event.ENTER_FRAME,checkPrevFrameF);
    symb.addEventListener(KeyboardEvent.KEY_DOWN, mc_pager);
    //whatever else

  • Converting AS3 to AS2. Some movieclip buttons not working.

    25 movieclip buttons in frame 126 maintimeline. Buttons are on top layer above all other content.
    Buttons 1_1, 2_1, 3_1, 4_1, and 5_1 work. All buttons have correct instance name. The buttons are in a 5x5 grid. Hence the naming convention of column_row. So all row 1 buttons are working. Do not get hand cursor over any of the other buttons. This is totally baffling. I am using Flash CS4. The file is saved as CS3 and the publish settings are AS2, Flash player 8.
    Here is the AS for frame 126.
    stop();
    trace("tScore = "+tScore);
    trace("i = "+i);
    if (i == 0) {
        i++;
    this.podium.signin.unloadMovie();
    videoBtn1_1.onRelease = function() {
        gotoAndStop(127);
        videoBtn1_1.play();
    videoBtn2_1.onRelease = function() {
        gotoAndStop(127);
        videoBtn2_1.play();
    videoBtn3_1.onRelease = function() {
        gotoAndStop(127);
        videoBtn3_1.play();
    videoBtn4_1.onRelease = function() {
        gotoAndStop(127);
        videoBtn4_1.play();
    videoBtn5_1.onRelease = function() {
        gotoAndStop(127);
        videoBtn5_1.play();
    this.videoBtn1_2.onRelease = function() {
        gotoAndStop(127);
        videoBtn1_2.play();
    videoBtn2_2.onRelease = function() {
        gotoAndStop(127);
        videoBtn2_2.play();
    videoBtn3_2.onRelease = function() {
        gotoAndStop(127);
        videoBtn3_2.play();
    videoBtn4_2.onRelease = function() {
        gotoAndStop(127);
        videoBtn4_2.play();
    videoBtn5_2.onRelease = function() {
        gotoAndStop(127);
        videoBtn5_2.play();
    videoBtn1_3.onRelease = function() {
        gotoAndStop(127);
        videoBtn1_3.play();
    videoBtn2_3.onRelease = function() {
        gotoAndStop(127);
        videoBtn2_3.play();
    videoBtn3_3.onRelease = function() {
        gotoAndStop(127);
        videoBtn3_3.play();
    videoBtn4_3.onRelease = function() {
        gotoAndStop(127);
        videoBtn4_3.play();
    videoBtn5_3.onRelease = function() {
        gotoAndStop(127);
        videoBtn5_3.play();
    videoBtn1_4.onRelease = function() {
        gotoAndStop(127);
        videoBtn1_4.play();
    videoBtn2_4.onRelease = function() {
        gotoAndStop(127);
        videoBtn2_4.play();
    videoBtn3_4.onRelease = function() {
        gotoAndStop(127);
        videoBtn3_4.play();
    videoBtn4_4.onRelease = function() {
        gotoAndStop(127);
        videoBtn4_4.play();
    videoBtn5_4.onRelease = function() {
        gotoAndStop(127);
        videoBtn5_4.play();
    videoBtn1_5.onRelease = function() {
        gotoAndStop(127);
        videoBtn1_5.play();
    videoBtn2_5.onRelease = function() {
        gotoAndStop(127);
        videoBtn2_5.play();
    videoBtn3_5.onRelease = function() {
        gotoAndStop(127);
        videoBtn3_5.play();
    videoBtn4_5.onRelease = function() {
        gotoAndStop(127);
        videoBtn4_5.play();
    videoBtn5_5.onRelease = function() {
        gotoAndStop(127);
        videoBtn5_5.play();

    You can probably reduce all that interaction code to a loop...
    for(i=1; i<6; i++){
       for(k=1; k<6; k++){
          this["videoBtn"+i+"_"+k].onRelease = function() {
              gotoAndStop(127);
              this.play();
    As for why movng the buttons to another layer fixed anything, it will not have mattered.  Whatever fixed the problem will remain a mystery.  It could have been an issue with instance names/frames since you are at frame 126 for some reason.  If you transition the buttons into place, that might be related to what the problem was.

  • XML - thumbnail scroller loading out of order on browser refresh

    I have a thumbnail scroller that is loading in random order
    on the browser refresh. I don't want
    it to do this. I have no clue what to change in the file to
    prevent it.
    Can I get some help?? ( Safari load it correctly each time.
    IE and Firefox renders wrong )
    www.crystalgraphix.net/test/scroll1.html

    In the top right of the media browser, there is a little icon called the flyout menu...  click it and choose 'Edit Columns'.
    Put a checkmark in the box called 'date Created'and then click ok
    Now, at the top of the media browser the columns 'Name', FilePath, 'DateCreated' should be listed.  You can sort your media by any of those columns by clicking on them.
    Not sure about bridge... maybe someone else can help you with that.
    David

  • AS3: Alpha Tween from one MovieClip to Another

    Hi folks,
    Using AS3, how do I create an alpha tween from one movie clip to another?
    My thinking is that I can't use the timeline, because the fade is variable and event driven; e.g., the user clicks on one of many pics, and the stage alpha tweens from the current to the clicked. But maybe I'm wrong.
    Any suggestions?
    tyvm!

    Look into the AS3 Tween class. If you need to coordinate the tweening based on one tweening out before the other tweens in, then you will also want to look into having event listeners in play to detect when the tween finishes.
    Here's a link to a sample file I created to help demo things:
    http://www.nedwebs.com/Flash/AS3_Tween_Images.fla

  • As3-cs4 package.as subclasses MovieClip, fla generates error 5000 anyway

    Hi, I am working with a trial version of Flash CS4 on a leopard intel mac.
    Starting with a clean os install, and a clean cs4 install I do the following
    start Adobe Flash CS4: Trial Version
    Select "I would like to continue to use this product on a trial basis" and continue...
    select create new Flash File (action script 3.0)
    open actions window
    type the following..
    trace("hello world");
    save file test_report.fla
    test file
    output ok.
    close swf window
    file > new > action script file
    type in the following code
    package {
        public class test_report{
            public function test_report(){
                trace("Hello world");
    select the test_report.fla tab
    fill in the "Class:" textbox of the property window with the string "test_report"
    click the pencil icon to test that pathing is ok, the UI opens test_report.as so it must be ok.
    test the movie
    2 errors
    1180: Call to a possibley undefined method addFrameScript
    5000: the class "test_report" must subclass 'flash.display.MovieClip' yada yada
    so add the offending line to the as file so that it looks like this..
    package {
        public class test_report{
            import flash.display.MovieClip;
            public function test_report(){
                trace("Hello world");
    save and test movie, same two errors
    AS IF I HAD NOT MADE THE ENTRY!
    NOTHING I CAN DO WILL MAKE THE ERROR GO AWAY
    obviously I am doing something wrong, please help!
    I only have 15 days left on the trial and I would really like to know I can get this to work on leopard!
    thanks
    rob
    Hardware Overview:
      Model Name:    iMac
      Model Identifier:    iMac7,1
      Processor Name:    Intel Core 2 Duo
      Processor Speed:    2.4 GHz
      Number Of Processors:    1
      Total Number Of Cores:    2
      L2 Cache:    4 MB
      Memory:    1 GB
      Bus Speed:    800 MHz
      Boot ROM Version:    IM71.007A.B03
      SMC Version:    1.20f4
      Serial Number:    W880759YX86
      System Version:    Mac OS X Server 10.5.6 (9G71)
      Kernel Version:    Darwin 9.6.0
      Boot Volume:    workSystem
      Boot Mode:    Normal
      Computer Name:    kbox
      User Name:    rob foree (robforee)
      Time since boot:    1:02

    Hi,
    First of all
    import flash.display.MovieClip;
    should be just after "package {" not "class... {"
    and
    public class test_report extends MovieClip
    report further situation

  • Creating AIR/Web Apps. with XML & E4X using AS3

    Needing tips using AS3 with XML/E4X to make my project work over the server:
    1) Here I'm having trouble trying to create a component with a 'GOOGLE MAP' with the user being able to input their location for directions with once submitting the get directions button that it generates the directions in the datagrid automatically.
    2) Including a 'DATAGRID'  for customers to be able to retain their info in a datagrid that has been updated by office personnel from an 'AIR APPLICATION' with a XML file that holds the customers info
    /**the Component*/
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:s="library://ns.adobe.com/flex/spark" width="1400" backgroundColor="#666666" xmlns:mx2="library://ns.adobe.com/flex/mx" creationComplete="initApp(event)">
        <mx:Style source="map_1.css"/>
        <mx:XML id="customer_info.xml" source="Assets/customer_info.xml" />
    <mx:Script>
            <![CDATA[
                /**Google Map Code API:http://code.google.com/apis/maps/documentation/flash/tutorial-flexbuilder.html#DeclaringMa ps_&
                 _http://www.adobe.com/devnet/flex/articles/googlemaps_api.html */
                import com.google.maps.LatLng;
                import com.google.maps.Map;
                import com.google.maps.MapEvent;
                import com.google.maps.MapType;
                private function onMapReady(event:Event):void {
                        this.map.setCenter(new LatLng(31.683952973286058, -97.09904551506042), 14, MapType.NORMAL_MAP_TYPE);
                            click="processForm(event);"
                            private function processForm(event:Event):void { trace(from.text + " " + to.text); }
                [Bindable]
                    public var directionsSteps:ArrayCollection = new ArrayCollection();
                    dataProvider="{directionsSteps}"
                    var directions:Directions = new Directions(); directions.addEventListener(DirectionsEvent.DIRECTIONS_SUCCESS, onDirectionsSuccess);
                    directions.addEventListener(DirectionsEvent.DIRECTIONS_FAILURE, onDirectionsFail);directions.load("from: " + from.text + " to: " + to.text);
                    Alert.show("Status:" + event.directions.status);
                    map.clearOverlays(); var directions:Directions = event.directions; var directionsPolyline:IPolyline = directions.createPolyline(); map.addOverlay(directionsPolyline);
                                var directionsBounds:LatLngBounds = directionsPolyline.getLatLngBounds(); map.setCenter(directionsBounds.getCenter()); map.setZoom(map.getBoundsZoomLevel(directionsBounds));
                                var startLatLng:LatLng = dir.getRoute(0).getStep(0).latLng;
                                var endLatLng:LatLng = dir.getRoute(directions.numRoutes-1).endLatLng; map.addOverlay(new Marker(startLatLng)); map.addOverlay(new Marker(endLatLng));
                    for (var r:Number = 0 ; r < directions.numRoutes; r++ ) { var route:Route = directions.getRoute(r); for (var s:Number = 0 ; s < route.numSteps; s++ )
                    { var step:Step = route.getStep(s); directionsSteps.addItem(step);
                                    directionsSteps.removeAll();
                                    itemClick="onGridClick(event)"
                                    privatefunction onGridClick(event:Event):void { var latLng:LatLng = directionsGrid.selectedItem.latLng;
                                        var opts:InfoWindowOptions = new InfoWindowOptions(); opts.contentHTML = directionsGrid.selectedItem.descriptionHtml; map.openInfoWindow(latLng, opts);
                                        var ServerPath:String = "http://www.sometext.com/";
                                        var ServerPage:String = serverPath + "getCountries";
                                                dataProvider="{directionsSteps}"
                                                var directions:Directions = new Directions(); directions.addEventListener(DirectionsEvent.DIRECTIONS_SUCCESS, onDirectionsSuccess); directions.addEventListener(DirectionsEvent.DIRECTIONS_FAILURE, onDirectionsFail);
                                                directions.load("from: " + from.text + " to: " + to.text);
                                                Alert.show("Status:" + event.directions.status);
                                                map.clearOverlays(); var directions:Directions = event.directions; var directionsPolyline:IPolyline = directions.createPolyline();
                                                map.addOverlay(directionsPolyline);
                                                var directionsBounds:LatLngBounds = directionsPolyline.getLatLngBounds(); map.setCenter(directionsBounds.getCenter());
                                                map.setZoom(map.getBoundsZoomLevel(directionsBounds));
                                                var startLatLng:LatLng = dir.getRoute(0).getStep(0).latLng; var endLatLng:LatLng = dir.getRoute(directions.numRoutes-1).endLatLng; map.addOverlay(new Marker(startLatLng));
                                                map.addOverlay(new Marker(endLatLng));
                                                for (var r:Number = 0 ; r < directions.numRoutes; r++ ) { var route:Route = directions.getRoute(r); for (var s:Number = 0 ; s < route.numSteps; s++ )
                                                { var step:Step = route.getStep(s); directionsSteps.addItem(step); } }
                                                directionsSteps.removeAll();
                                                itemClick="onGridClick(event)"
                        import flash.events.IOErrorEvent;
                        import flash.events.SecurityErrorEvent;
                                    var sender:URLLoader;
                                    var sendPage:URLRequest;
                                    var sendVars:URLVariables;
                                         initApp;
                                        function initApp:void {
                                    var ServerPath:String = "http://localhost/silverfoxcc/";
                                    var url:String = serverPath + "login.aspx";
                                    sender = new URLLoader();
                                    sendPage = new URLRequest(url);
                                    sendPage.method = URLRequest.POST;
                                    sendvars = new URLVariables();
                                    SUBMIT.btn.addEventListener(MouseEvent.CLICK, clickHandler);
                                    sender.addEventListener(Event.COMPLETE, completeHandler);
                                    sender.addEventListener(IOErrorEvent.SECURITY_ERROR, securityErrorhandler);
                                                function clickhandler(e:MouseEvent:void{
                                                    var suppSUBMIT:String = username_txt.text;
                                                    var suppRESET:String = reset_txt.text;
                                                    if (suppSUBMIT.length > 0 && suppRESET.length > 0) {
                                                        message_txt.text = "";
                                                        sendVars.submit = suppSUBMIT;
                                                        sendVars.reset = suppRESET;
                                                        sendPage.data = sendVars;
                                                        sender.load(sendPage);
                                                    else{
                                                        message_txt.text ="You must enter a last name and customer identification before clicking the submit button."
                                                  function completeHandler(e:Event):void{
                                                      var xmlResponse:XML = XML(e.target.data;
                                                          var userMessage:String;
                                                          if (xmlResponse.text().toString() == "true") {
                                                              userMessage = "Congratulations, information is retrieved"'';
                                                          else {
                                                              usermessage = "Information to be retrieved failed. Please try again";
                                                                              message_txt.text =userMessage;
                                                                      function ioErrorHandler(e:IOErrorEvent):void{
                                                                          message_txt.text = e.text;
                                                                      function securityErrorHandler(e:SecurityErrorEvent):void {
                                                                          message_txt.text = e.text;
                                                             /**Foundation for Ed: XML & E4X-Chapter 9: COMMUNICATION WITH THE SERVER*/
                                                              import mx.events.FlexEvent;
                                                              import xmlUtilities.XMLLoader;
                                                              import flash.events.IOErrorEvent;
                                                              import flash.events.SecurityErrorEvent
                                                              private var serverPath:String = "http://localhost/FOE/";
                                                              private function initApp(e:FlexEvent):void {
                                                                  myXMLLoader = new XMLLoader();
                                                                  myXMLLoader.addEventListener(Event.COMPLETE, completeHandler);
                                                                  myXMLLoader.addEventListener(IOErrorEvent.IO_Error, IOErrorHandler);
                                                                  SUBMIT.btn.addEventListener(MouseEvent.CLICK, clickHandler);
                                                                          private function completeHandler(e:Event):void{
                                                                              var userMessage:String;
                                                                              var response:String =myXMLLoader.response().toString();
                                                                              if (response:String = myXMLLoader.response().toString();
                                                                                  if (response == true"){
                                                                                         usermessage = "Congratualtions. You were successful";
                                                                                              else{
                                                                                            userMessage = Login failed. Please try again";
                                                                                      message_txt.text = userMessage;
                                                                                  private function clickHandler(e:MouseEvent):void{
                                                                                      var SUBMIT:String = submit_txt.text;
                                                                                      var RESET:String = reset_txt.text;
                                                                                      vars myVars:URLVariables = new URLVariables();
                                                                                      if (username.length > 0 && password.length > 0) {
                                                                                          myVars.SUBMIT = submit;
                                                                                          myVars.CUSTMER ID = customerid;
                                                                                          myXMLLOADER.loafxml("login.aspx, myVars);
                                                                                            else {
                                                                                             message_txt.text = "You must enter a last name and customer id before clicking the submit button"
                                                                                  private function IOErrorHandler(e:IOErrorEvent):void{
                                                                                      message_txt.text = e.text;
                                                                                  private function securityErrorHandler(e:SecurityErrorEvent):void{
                                                                                      message_txt.text = e.text;
                                                                            /**Foundation for Ed: XML & E4X-Chapter 8: MODIFYING XML CONTENT WITH ACTIONSCRIPT 3.0*/
                                                                                import mx.events.FlexEvent;
                                                                                import mx.events.ListEvent;
                                                                                import mx.collections.XMLListCollection;
                                                                                import xmlUtilities.MyXMLLoaderHelper;
                                                                                import mx.events.FlexEvent;
                                                                                import mx.events.DataGridEvent;
                                                                                private function initApp(e:Event):void {
                                                                                /add testing lines here
                                                                                            private var myXMLLoader:MyXMLLoaderHelper;
                                                                                            private function initApp(e:FlexEvent):void {
                                                                                                 myXMLLoader = new MyXMLLoaderHelper();
                                                                                                 myXMLLoader.addEventListener(Event.COMPLETE, completeHandler);
                                                                                                 myXMLLoader.addEventListener("xmlUpdated", xmlUpdatedHandler);
                                                                                                 authors_cbo.addEventListener(ListEvent.CHANGE, changeHandler);
                                                                                                 addRow_btn.addEventListener(MouseEvent.CLICK, addClickHandler);
                                                                                                 delete_btn.addEventListener(MouseEvent.CLICK, deleteClickHandler);
                                                                                                 books_dg.addEventListener(DataGridEvent.ITEM_EDIT_END, itemEditEndHandler);
                                                                                                 authors_cbo.labelFunction = getFullName;
                                                                                                 myXMLLoader.loadXML("Assets/customer_info.xml", "lastname");
                                                                                            private function completeHandler(e:Event):void {
                                                                                                 authors_cbo.dataProvider = myXMLLoader.getChildElements("author");
                                                                                                 tree_txt.text = myXMLLoader.getXML().toXMLString();
                                                                                                 books_dg.dataProvider = myXMLLoader.getBooks(0);
                                                                                            private function getFullName(item:Object):String {
                                                                                              return item.authorFirstName + " " + item.customerLastName;
                                                                                            private function changeHandler(e:Event):void {
                                                                                                 books_dg.dataProvider = myXMLLoader.getBooks(e.target.selectedIndex);
                                                                                            private function addClickHandler(e:MouseEvent):void {
                                                                                              var newBookName:String = name_txt.text;
                                                                                              var newPublishYear:String = year_txt.text;
                                                                                              var newBookCost:String = cost_txt.text;
                                                                                              var authorIndex:int = authors_cbo.selectedIndex;
                                                                                              if(newBookName.length > 0 && newPublishYear.length > 0 && newBookCost.length > 0) {
                                                                                                 myXMLLoader.addBook(authorIndex, newBookName, newPublishYear, newBookCost);
                                                                                            private function deleteClickHandler(e:MouseEvent):void {
                                                                                              var bookIndex:int = books_dg.selectedIndex;
                                                                                              var authorIndex:int = authors_cbo.selectedIndex;;
                                                                                              if (books_dg.selectedIndex != -1) {
                                                                                                 myXMLLoader.deleteBook(authorIndex, bookIndex);
                                                                                            private function itemEditEndHandler(e:DataGridEvent):void {
                                                                                              var authorIndex:int = authors_cbo.selectedIndex;
                                                                                              var dg:DataGrid = e.target as DataGrid;
                                                                                              var field:String = e.dataField;
                                                                                              var row:int = e.rowIndex;
                                                                                              var col:int = e.columnIndex;
                                                                                              var oldVal:String = e.itemRenderer.data[field];
                                                                                              var newVal:String = dg.itemEditorInstance[dg.columns[col].editorDataField];
                                                                                              if (oldVal != newVal) {
                                                                                                   myXMLLoader.modifyXMLTree(authorIndex, dg.columns[col].dataField, row, newVal)
                                                                                            private function xmlUpdatedHandler(e:Event):void {
                                                                                                 books_dg.dataProvider = myXMLLoader.getBooks(authors_cbo.selectedIndex);
                                                                                                 tree_txt.text = myXMLLoader.getXML().toXMLString();
            ]]>
        </mx:Script>
        <s:Panel x="9" y="257" width="459" height="383" contentBackgroundColor="#666666" backgroundColor="#666666" chromeColor="#FCF6F6" title="DIRECTIONS TO SILVER FOX COLLISION CENTER:" fontSize="14">
            <s:TextInput x="55" y="7" contentBackgroundColor="#030000" height="17" width="392"/>
            <mx:Label x="3" y="6" text="FROM:" fontSize="14" color="#FDF9F9"/>
            <s:TextInput x="1114" y="637" contentBackgroundColor="#FCF7F7" height="17" width="213"/>
            <s:Button x="1337" y="634" label="GET DIRECTIONS" focusColor="#FBFCFD" chromeColor="#666666" color="#FEFEFE" width="141" fontSize="14"/>
            <mx:Label x="1088" y="637" text="TO:" fontSize="12" color="#FDFBFB"/>
            <s:Button x="295" y="56" label="GET DIRECTIONS" focusColor="#FBFCFD" chromeColor="#666666" color="#FEFEFE" width="157" fontSize="12"/>
            <s:TextInput x="55" y="31" contentBackgroundColor="#070000" height="17" width="392"/>
            <mx:Label x="25" y="30" text="TO:" fontSize="14" color="#FDFBFB"/>
        </s:Panel>
        <mx2:DataGrid x="10" y="54" width="458" height="104" color="#666666" contentBackgroundColor="#060000" borderColor="#030000" fontSize="8" focusColor="#666666" chromeColor="#030000" selectionColor="#666666" dropShadowVisible="true" rollOverColor="#FFFFFF">
            <mx2:columns>
                <mx2:DataGridColumn headerText="LAST NAME:" dataField="col1"/>
                <mx2:DataGridColumn headerText="DESIGNATED DUE DATE:" dataField="col2"/>
                <mx2:DataGridColumn headerText="STATUS UPDATED:" dataField="col3"/>
                <mx2:DataGridColumn headerText="CUSTOMER ID:" dataField="col3"/>
            </mx2:columns>
        </mx2:DataGrid>
        <mx:Text id="directionsSummary" width="100%"/> <mx:DataGrid id="directionsGrid" dataProvider="{directionsSteps}" width="100%" height="100%" sortableColumns="false" />
        <mx:Text id="directionsCopyright" width="100%"/>
        <mx:HBox> <mx:Label text="From: " width="70"/> <mx:TextInput id="from" text="San Francisco, CA" width="100%"/> </mx:HBox>
        <mx:HBox> <mx:Label text="To: " width="70"/> <mx:TextInput id="to" text="Mountain View, CA" width="100%"/> </mx:HBox>
        <s:Label x="11" y="38" text="LAST NAME:" color="#FCFBFB" fontSize="14" verticalAlign="top"/>
        <s:TextArea x="96" y="32" width="145" height="18" focusColor="#FCFAFA" color="#010000" contentBackgroundColor="#000000" id="message_txt" text="{xmlService.lastResult.toString()}>
        <s:Label x="273" y="37" text="CUSTOMER ID;" fontSize="14" color="#FDFBFB"/>
        <s:TextInput x="376" y="32" width="89" height="18" focusColor="#FCF9F9" color="#FAF8F8" contentBackgroundColor="#040000"/>
        <s:Button x="318" y="212" label="RESET" focusColor="#F8FAFB" color="#FEFBFB" chromeColor="#666666" fontSize="12"/>
        <s:Button x="393" y="212" label="SUBMIT" focusColor="#F8F9FA" color="#FFFBFB" chromeColor="#666666" fontSize="12"/>
        <s:TextArea x="10" y="160" width="458" height="48" color="#FEF8F8" contentBackgroundColor="#050000"/>
        <mx:Panel x="483" y="31" width="750" height="609" layout="absolute" backgroundColor="#666666" borderVisible="true" dropShadowVisible="true" chromeColor="#FDF9F9">
            <mx:VBox x="26" y="7" height="559" width="708">
                <maps:Map xmlns:maps="com.google.maps.*" id="map" mapevent_mapready="onMapReady(event)" x="500" y="25" width="700" height="550" key="ABQIAAAA9YXHa-b0xqHBMiooUNYUbhRpa9TAnukyOWjhoGl3Y9H2BJoi9xSrm6cnM0lBZ4lCtqRLxKpQK_eb Rg" sensor="true"/>
            </mx:VBox>
        </mx:Panel>
    </mx:Application>
    /**the AIR APPLICATION*/
    <?xml version="1.0" encoding="utf-8"?>
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                           xmlns:s="library://ns.adobe.com/flex/spark"
                           xmlns:mx="library://ns.adobe.com/flex/mx" backgroundColor="#666666" width="854" height="348" creationComplete="initApp(event)">
        <s:HTTPService id="customer_info" url="data/customer_info.xml" resultFormat="e4x" result="resultHandler(event)"/>
        <mx:Script>
            <![CDATA[
            /**FLEX 4 Bible: Chapter 24- Managing XML w/ E4X*/
            private var xmlData:XML;
            private function resultHandler(event:ResultEvent):void
                xmlData = event.result as XML:
            ]]>
        </mx:Script>
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <mx:Image source="@Embed('Assets/logo.png')" x="1" y="0" width="760" height="168"/>
        <s:Label x="96" y="126" text="Last Name:&#xd;" color="#FFFFFF" fontSize="20" fontFamily="Times New Roman"/>
        <s:Label x="13" y="218" text="Designated Due Date:&#xd;" fontSize="20" fontFamily="Times New Roman" color="#FBF8F8"/>
        <s:Label x="63" y="186" text="Status Updated:&#xd;" color="#FCF5F5" fontSize="20" fontFamily="Times New Roman"/>
        <s:TextInput x="192" y="125" width="196"/>
        <s:TextInput x="193" y="215" width="195"/>
        <s:TextInput x="193" y="185" width="195"/>
        <s:Label x="80" y="158" text="Customer ID:" color="#FDFCFC" fontSize="20" fontFamily="Times New Roman"/>
        <s:TextInput x="192" y="155" width="196"/>
        <s:Button x="243" y="241" label="RESET"/>
        <s:Button x="317" y="241" label="UPDATE" focusColor="#666666"/>
    </s:WindowedApplication>
    /**the Customer Information XML*/
    <?xml version="1.0" encoding="utf-8"?>
        <allNames>
            <name namesID="1">
                <nameLastName>Ambrose</nameLastName>
                <customerids>
                    <customerid customerID="1">
                        <customerID>777777</customerID>
                    </customerid>
                </customerids>

    Hi All,
    please note that we found the problem. The problem was that we didn't configure under:
    "Configuration-> Security -> Message Security -> SOAP" the voprrect provider to handle the security.
    After that was done (extract of domain.xml) the message was understood.
    <provider-config class-name="com.sun.identity.agents.jsr196.as9soap.AMServerAuthModule" provider-id="AMServerProvider-UserNameToken-Plain" provider-type="server">
                <request-policy auth-source="content"/>
                <response-policy auth-source="content"/>
                <property name="providername" value="UserNameToken-Plain"/>
              </provider-config>unfortunately the next problem occured I will post in a new thread.
    Edited by: rankin_ut on Jan 26, 2009 4:43 AM

  • XML Help

    So i will try to explain it as i can . So I have this flash game. In it there is one movie clip called address_group. In address_group i have another MC called address. In address i have many text fields. Their info is being loaded from a xml file called database.xml. In the timeline where my address_group MC is located i have placed this code to load the XML data to flash:
    var planet_title = new Array();
    var planet_subtitle = new Array();
    var chevron1_txt = new Array();
    var chevron2_txt = new Array();
    var chevron3_txt = new Array();
    var chevron4_txt = new Array();
    var chevron5_txt = new Array();
    var chevron6_txt = new Array();
    var chevron7_txt = new Array();
    var chevron8_txt = new Array();
    var symbol_1 = new Array();
    var symbol_2 = new Array();
    var symbol_3 = new Array();
    var symbol_4 = new Array();
    var symbol_5 = new Array();
    var symbol_6 = new Array();
    var symbol_7 = new Array();
    var symbol_8 = new Array();
    var planet_stats = new Array();
    var planet_id = new Array();
    var pln_location = new Array();
    var pln_atmos = new Array();
    var pln_weather = new Array();
    var pln_day = new Array();
    var pln_inhabited = new Array();
    var database = new XML();
    database.ignoreWhite = true;
    database.load("database.xml");
    dir = address_group.address
    database.onLoad = function()
    var nodes:Array = this.firstChild.childNodes;
    for(var i=0;i<nodes.length;i++)
    planet_title.push(nodes[i].attributes.title_planet);
    planet_subtitle.push(nodes[i].attributes.subtitle);
    chevron1_txt.push(nodes[i].attributes.chevron1_name);
    chevron2_txt.push(nodes[i].attributes.chevron2_name);
    chevron3_txt.push(nodes[i].attributes.chevron3_name);
    chevron4_txt.push(nodes[i].attributes.chevron4_name);
    chevron5_txt.push(nodes[i].attributes.chevron5_name);
    chevron6_txt.push(nodes[i].attributes.chevron6_name);
    chevron7_txt.push(nodes[i].attributes.chevron7_name);
    chevron8_txt.push(nodes[i].attributes.chevron8_name);
    symbol_1.push(nodes[i].attributes.symbol1_name);
    symbol_2.push(nodes[i].attributes.symbol2_name);
    symbol_3.push(nodes[i].attributes.symbol3_name);
    symbol_4.push(nodes[i].attributes.symbol4_name);
    symbol_5.push(nodes[i].attributes.symbol5_name);
    symbol_6.push(nodes[i].attributes.symbol6_name);
    symbol_7.push(nodes[i].attributes.symbol7_name);
    symbol_8.push(nodes[i].attributes.symbol8_name);
    planet_stats.push(nodes[i].attributes.planet_status);
    planet_id.push(nodes[i].attributes.ID);
    pln_location.push(nodes[i].attributes.pln_cuadrant);
    pln_atmos.push(nodes[i].attributes.planet_atmosphere);
    pln_weather.push(nodes[i].attributes.planet_weather);
    pln_day.push(nodes[i].attributes.planet_day_cycle);
    pln_inhabited.push(nodes[i].attributes.planet_inhabited);
    dir.title.text = planet_title;
    dir.sub_title.text = planet_subtitle;
    dir.chev1_name.text = chevron1_txt;
    dir.chev2_name.text = chevron2_txt;
    dir.chev3_name.text = chevron3_txt;
    dir.chev4_name.text = chevron4_txt;
    dir.chev5_name.text = chevron5_txt;
    dir.chev6_name.text = chevron6_txt;
    dir.chev7_name.text = chevron7_txt;
    dir.chev8_name.text = chevron8_txt;
    dir.SB1.text = symbol_1;
    dir.SB2.text = symbol_2;
    dir.SB3.text = symbol_3;
    dir.SB4.text = symbol_4;
    dir.SB5.text = symbol_5;
    dir.SB6.text = symbol_6;
    dir.SB7.text = symbol_7;
    dir.SB8.text = symbol_8;
    dir.planet_status.text = planet_stats;
    dir.planet_id.text = planet_id;
    dir.location.text = pln_location;
    dir.weather.text = pln_weather;
    dir.day_cycle.text = pln_day;
    dir.inhabited.text = pln_inhabited;
    My xml file structure is this:
    <?xml version="1.0" encoding="utf-8"?>
    <planets>
    <planet title_planet="Lqlq"
    subtitle="M45-98R"
    chevron1_name="Asus"
    chevron2_name="Asus"
    chevron3_name="Asus"
    chevron4_name="Asus"
    chevron5_name="Asus"
    chevron6_name="Asus"
    chevron7_name="Asus"
    chevron8_name="Asus"
    symbol1_name="d"
    symbol2_name="d"
    symbol3_name="d"
    symbol4_name="d"
    symbol5_name="d"
    symbol6_name="d"
    symbol7_name="d"
    symbol8_name="d"
    planet_status="ACTIVE"
    ID="#653265"
    pln_cuadrant="C8 Cuadrant"
    planet_atmosphere="YES"
    planet_weather="NORMAL"
    planet_day_cycle="24 hrs"
    planet_inhabited="NO" />
    <planet title_planet="Lqlq"
    subtitle="M45-98R"
    chevron1_name="Asus"
    chevron2_name="Asus"
    chevron3_name="Asus"
    chevron4_name="Asus"
    chevron5_name="Asus"
    chevron6_name="Asus"
    chevron7_name="Asus"
    chevron8_name="Asus"
    symbol1_name="d"
    symbol2_name="d"
    symbol3_name="d"
    symbol4_name="d"
    symbol5_name="d"
    symbol6_name="d"
    symbol7_name="d"
    symbol8_name="d"
    planet_status="ACTIVE"
    ID="#653265"
    pln_cuadrant="C8 Cuadrant"
    planet_atmosphere="YES"
    planet_weather="NORMAL"
    planet_day_cycle="24 hrs"
    planet_inhabited="NO" />
    </planets>
    My problem is that when there is a second <planet title_planet="Name"....> the new info from the second input which should be a new entry which means that i want when there is a second input this address_group to duplicate and in it to be placed the info from the second entry. But it doesnt do that it loads the second info over the first one in the flash. So my question is how to make flash to detect if there is something written as second entry or third or forth and so on... and than when he detects to duplicate this address_group Movie Clip and in it to put the info from the second enttry if they are 3 to make 3 copies of the MC and put in each the different informations....
    Did you understand what i mean please help? thanks a lot

    sorry.  that would only work for as3.
    for as2, assign address_group a linkage id (say address_groupID), and use:
    var planet_title = new Array();
    var planet_subtitle = new Array();
    var chevron1_txt = new Array();
    var chevron2_txt = new Array();
    var chevron3_txt = new Array();
    var chevron4_txt = new Array();
    var chevron5_txt = new Array();
    var chevron6_txt = new Array();
    var chevron7_txt = new Array();
    var chevron8_txt = new Array();
    var symbol_1 = new Array();
    var symbol_2 = new Array();
    var symbol_3 = new Array();
    var symbol_4 = new Array();
    var symbol_5 = new Array();
    var symbol_6 = new Array();
    var symbol_7 = new Array();
    var symbol_8 = new Array();
    var planet_stats = new Array();
    var planet_id = new Array();
    var pln_location = new Array();
    var pln_atmos = new Array();
    var pln_weather = new Array();
    var pln_day = new Array();
    var pln_inhabited = new Array();
    var database = new XML();
    database.ignoreWhite = true;
    database.load("database.xml");
    var tl:MovieClip=this;
    database.onLoad = function()
    var nodes:Array = this.firstChild.childNodes;
    for(var i=0;i<nodes.length;i++)
    var address_group:MovieClip = tl.attachMovie("attach_groupID","attach_groupMC_"+i,tl.getNextHighestDepth());
    address_group._ x= i*100;
    // assign x,y and any other properties needed for display
    var dir:MovieClip = address_group.address;
    planet_title.push(nodes[i].attributes.title_planet);
    planet_subtitle.push(nodes[i].attributes.subtitle);
    chevron1_txt.push(nodes[i].attributes.chevron1_name);
    chevron2_txt.push(nodes[i].attributes.chevron2_name);
    chevron3_txt.push(nodes[i].attributes.chevron3_name);
    chevron4_txt.push(nodes[i].attributes.chevron4_name);
    chevron5_txt.push(nodes[i].attributes.chevron5_name);
    chevron6_txt.push(nodes[i].attributes.chevron6_name);
    chevron7_txt.push(nodes[i].attributes.chevron7_name);
    chevron8_txt.push(nodes[i].attributes.chevron8_name);
    symbol_1.push(nodes[i].attributes.symbol1_name);
    symbol_2.push(nodes[i].attributes.symbol2_name);
    symbol_3.push(nodes[i].attributes.symbol3_name);
    symbol_4.push(nodes[i].attributes.symbol4_name);
    symbol_5.push(nodes[i].attributes.symbol5_name);
    symbol_6.push(nodes[i].attributes.symbol6_name);
    symbol_7.push(nodes[i].attributes.symbol7_name);
    symbol_8.push(nodes[i].attributes.symbol8_name);
    planet_stats.push(nodes[i].attributes.planet_status);
    planet_id.push(nodes[i].attributes.ID);
    pln_location.push(nodes[i].attributes.pln_cuadrant);
    pln_atmos.push(nodes[i].attributes.planet_atmosphere);
    pln_weather.push(nodes[i].attributes.planet_weather);
    pln_day.push(nodes[i].attributes.planet_day_cycle);
    pln_inhabited.push(nodes[i].attributes.planet_inhabited);
    dir.title.text = planet_title;
    dir.sub_title.text = planet_subtitle;
    dir.chev1_name.text = chevron1_txt;
    dir.chev2_name.text = chevron2_txt;
    dir.chev3_name.text = chevron3_txt;
    dir.chev4_name.text = chevron4_txt;
    dir.chev5_name.text = chevron5_txt;
    dir.chev6_name.text = chevron6_txt;
    dir.chev7_name.text = chevron7_txt;
    dir.chev8_name.text = chevron8_txt;
    dir.SB1.text = symbol_1;
    dir.SB2.text = symbol_2;
    dir.SB3.text = symbol_3;
    dir.SB4.text = symbol_4;
    dir.SB5.text = symbol_5;
    dir.SB6.text = symbol_6;
    dir.SB7.text = symbol_7;
    dir.SB8.text = symbol_8;
    dir.planet_status.text = planet_stats;
    dir.planet_id.text = planet_id;
    dir.location.text = pln_location;
    dir.weather.text = pln_weather;
    dir.day_cycle.text = pln_day;
    dir.inhabited.text = pln_inhabited;
    My xml file structure is this:
    <?xml version="1.0" encoding="utf-8"?>
    <planets>
    <planet title_planet="Lqlq"
    subtitle="M45-98R"
    chevron1_name="Asus"
    chevron2_name="Asus"
    chevron3_name="Asus"
    chevron4_name="Asus"
    chevron5_name="Asus"
    chevron6_name="Asus"
    chevron7_name="Asus"
    chevron8_name="Asus"
    symbol1_name="d"
    symbol2_name="d"
    symbol3_name="d"
    symbol4_name="d"
    symbol5_name="d"
    symbol6_name="d"
    symbol7_name="d"
    symbol8_name="d"
    planet_status="ACTIVE"
    ID="#653265"
    pln_cuadrant="C8 Cuadrant"
    planet_atmosphere="YES"
    planet_weather="NORMAL"
    planet_day_cycle="24 hrs"
    planet_inhabited="NO" />
    <planet title_planet="Lqlq"
    subtitle="M45-98R"
    chevron1_name="Asus"
    chevron2_name="Asus"
    chevron3_name="Asus"
    chevron4_name="Asus"
    chevron5_name="Asus"
    chevron6_name="Asus"
    chevron7_name="Asus"
    chevron8_name="Asus"
    symbol1_name="d"
    symbol2_name="d"
    symbol3_name="d"
    symbol4_name="d"
    symbol5_name="d"
    symbol6_name="d"
    symbol7_name="d"
    symbol8_name="d"
    planet_status="ACTIVE"
    ID="#653265"
    pln_cuadrant="C8 Cuadrant"
    planet_atmosphere="YES"
    planet_weather="NORMAL"
    planet_day_cycle="24 hrs"
    planet_inhabited="NO" />
    </planets>
    p.s.  you assign a linkage id the same way you assign a class.  so, just remove the input from the class textfield and enter the linkage id in the linkage textfield.

Maybe you are looking for