Jump to content


  • Posts

  • Joined

  • Last visited

Posts posted by mrEmpty

  1. Just re-read your response. I don't have a group of loaders, I'm using 1 XMLLoader to grab a single XML file. The XML contains a few of these:


    <sectionHeader>Section 1 with line breaks and word wrap</sectionHeader>


    I can get at the sectionContentValue data fine, and push that into an array. I need to couple that number to the sprite which triggers an event.

  2. Trying another route, when looping through the XMLList I'm pushing my 'sectionContentValue' into an array. Can I then grab the position of the current item from it's array, as that number will match the second array with my custom vars.


    So, each menu section sits in an XMLList, and the custom vars sits in an array. The custom var's will math the buttons XMLList. So can I get to that?

  3. Hello.


    I still can't get this working. I've tried your suggestions, here is a cut down version of the section of code:


    private function init(event:Event):void {
      var xmlLoader:LoaderMax = new LoaderMax({maxConnections:1}); //create the loadermax instance
      xmlLoader.append(new XMLLoader('assets/config.xml', {onComplete:xmlLoaded}));  //add an xml loader, point it to the xml file
      xmlLoader.load();  //load the xml
     private function xmlLoaded(event:LoaderEvent):void {  //this method is called when the xml is loaded
      var numItems:XMLList = event.target.content.menuItem;  //take all the menuItems int he XML and store them in a list
      for (var i:int = 0; i < numItems.length(); i++) {  //for each of those menuItems create a sprite and load the text into them
    //stuff here to create a sprite for each section of the menu
    //give each section an event listener
    imSection.addEventListener(MouseEvent.ROLL_OVER, intelliGo);
    //add the items
    imSection.y = (stage.stageHeight/numItems.length())*i;
    imMenu.alpha = imAlpha;
      //get the extra vars
      var sectionValue:Array = LoaderMax.getLoader("assets/config.xml").getChildren();
      for (var i:int = 0; i < sectionValue.length; i++) {
    sectionValue[i].vars.contentLocation = "sectionContentValue";
     //I then, on a roll-over of the menu section, need to be able to get at the corrent sectionContentValue number for each section of the menu
     public function intelliGo(event:MouseEvent):void {
      //I don't know how to get at that


    When I trace to te sectionValue I get an empty line break in the console, but no errors.


    If I trace sectionValue[2] for example, I get 'unspecified'. If I trace sectionValue[2] as Number; I get null. So I have two problems, how to store those extra vars and how to link them with each section. With the ImageLoader you can specify extra vars such as name, and easily get access to that information. Can you do this when using the XMLLoader?


    Apologies for the odd formatting of this post, I did wrap code in the code tags.

  4. Hello.


    Work's servers are down so I can't get access to try this out until Monday, but I'll try mocking something up to give it a whirl. Thanks for the post.


    I'm creating a set of buttons from the XML, basically the XML has a series of (for example) tags which contain info for a textfield, colour etc. Each button must send content around, so I'm trying to have a var in the XML which holds a number, for simplicity here lets say 10, 20, 30. I create the buttons in a loop, giving them all a listener. When I trigger the listener I'm trying to get at that 10, 20, 30 etc var, so I can feed that to Tweenmax to move the content about.


    I've probably gone about it in a strange way, but it seemed the cleanest and so far it's working well. I love LoaderMax so much I've started sticking more stuff into the XML so I can use it more( no joke - must be the geek in me) and it may be clouding alternative methods! :)

  5. Hello.


    I'm using LoaderMax to build some dynamic menus from an XML file, everything is working well. However I'm now wondering how to do one thing. I want the XML file to hold a variable for each button, this variable is a number. When I mouse over the button, I want to be able to get at that number.


    My loader:


    xmlLoader.append(new XMLLoader('assets/config.xml', {contentLocation:"sectionContentValue" , onComplete:xmlLoaded})); 


    contentLocation is the number I want to get at, in the XML it's called sectionContentValue.


    Each button is given an event listener which trigger a function called intelliGo.


    public function intelliGo(event:MouseEvent):void {
    		//this function moves the content based upon where you press the menu


    Which obviously won't work. I have an XMLList storing all instances on a tag, inside this tag is the tag. I'm now at a loss of what to do, any pointers would be great. I'll keep poking and respond here if I fix it in the mean time.




  6. Hello.


    Yes, I am a member with the beta. My line manager didn't want me using 'untested code' but I'm thinking sod it, if he wants it on time (in roughly an hour form now in fact) I'll run with it. ;)


    EDIT: Hehehe, this is fun! I love paying for stuff, it feels god and you get cool new things to fiddle with. :) Job done in few seconds with a single tween.

  7. Hello.


    Scenario: cube on screen right, needs to animate to screen centre, then slowly move to the left say 25 pixels, then move off screen left. I want each tween to blend, so the fast move in blends with the slow move which blends with the fast move out.


    I'm using TimeLineMax currently.


    EDIT: Apologies, not sure what happened, this post went up without it being finished! I'll add the missing content tomorrow when I have my code to hand.

  8. That works :) Now I can release it, if it would be of any use to anyone I don't know.


    Thank you.


    So to get clear n my head what is going on, we are killing any TimelineLite tweens (if they exist), grabbing all TweenMax tweens and sticking them into a TimelineLite. Does the process of doing that kill the TweenMax tweens and create new ones, or does it simply reference the original tweens?


    We then tween down the time scale of the TimelineLite and use a new set of TweenMax tweens to open the GUI. Is that it?


    So from that we can control two 'sets' of tweens if one is TM and the other TL? Hmm, that opens a lot of cool stuff. How about adding an id to tweens so we can selectively control groups?


    Thank you once again, if you ever come to London let me know, I'll hook you up with beer :)

  9. 'what if they are using another tweening mechanism other than GreenSock?'






    Thanks, I came to the same conclusion, but am unable to accept it so am pressing on. I could go the messy route of using Tweener to do my tweens so they'll not be effected, bodge but it'd work. Can't bring myself to do it though. Can't believe I even typed it. I feel dirty.

  10. Hello.


    I am working on putting some final touches on my iOS style screen splitting class which I'll share as soon as it's ready. One of the last things I want to do is control any tweens currently playing when the screen split occurs. Currently I call TweenMax.pauseAll(); and that works fine, but it's very abrupt.


    What I'm hoping to do is take the tweens that are playing, slow and reduce them drastically, then call the split function, so...


    1: Square is on stage moving from top to bottom on a yoyo.

    2: User splits the screen.

    3: Square tween doesn't just stop, but comes to a pause over say 20 pixels.

    4: Screen split occurs.

    5: Screen un-splits, square tween quickly (but not instantly) goes back to it's original tween.


    As I have no control over what people are tweening or how they set up the tweens, can I hijack them globally?



  11. You're making sense :)


    I have a number (I'l call is Bob), I use 20 but anything sensible will do, that is a buffer I check against to see if the user is dragging or tapping. With touch screen software 20 is god, for software being accessed by a mouse, you could go with 5 or lower. I record the down click of the mouse as a number, then record the up click position as a second number. I then check to see if the second number is within Bob pixels of the first number, if it is I register it as a mouse event, if it's not I say it's a throw props event.


    Now I don't do anything clever here, I don't have custom handlers or anything (I do now, but that's a longer story), I simply trigger the appropriate function. If it's a click, throw the click function that does whatever a click would do, or get the Throwprops working if it's not.


    private function _mouseUpHandler(event:MouseEvent):void  //this function is called when the mouse up event happens on the throw props movie clip
            removeEventListener(MouseEvent.MOUSE_MOVE, _mouseMoveHandler);  //remove the listener
            mouseUX = mouseDX;  //these variables are the same ones we use to send a speed of throw to throwprops
            mouseDX = mouseY;
            vy = mouseDX - mouseUX;
            if (Math.abs(mouseDX - mouseUX) > tolerance)  //tolerance here is Bob, if the distance between down and up is greater than Bob...
               trace("Mouse up was not within range of mouse down (10px), so is not a button press");
               ThrowPropsPlugin.to(newMC, {throwProps:{y:{velocity:vy*2, min:bounds.top, max:bounds.bottom}, resistance:20}}, 10, 0.25, 1);  //... send the numbers to props and watch is glide
            else if (Math.abs(mouseDX - mouseUX) < tolerance)  //otherwise, if it's within the range of Bob
    //act as if it was a click
               trace("Mouse up was within range of mouse down (10px), so is a button press :)");
               trace("the detected button press was on: " + event.target.name);


    But it depends on what you're doing I guess. Post a sketch :)

  12. Hello.


    So you are trying to have items click-able inside of a throwprops movieclip?


    The way I did it was to store the mouse position on mouse down, then again on mouse up. At that point I would compare the two, if it was within n number of pixels I would consider it a click, otherwise it was considered a throw. It was handled inside of a conditional.


    The function shown in my post above yours has everything in it you'd need to get it working. If I still have my test project I'll zip and share it on here.

  13. Hello.


    I'm wondering if I could use two occurrences of a blit mask coupled with some tweening to replicate the iOS style GUI split when you open a folder of apps? Has anyone here got experience of grabbing and moving an entire series of sprites and movieclips inside of a blitmask?


    I'll try this later today, but I'm stuck in meetings, got excited, and asked - you know how it is :)