pipi7817 / mad-components

Automatically exported from code.google.com/p/mad-components
0 stars 0 forks source link

Getting started #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Okay, so I'm a simple guy with a simple development background. I saw this 
library recently and it seems to be a good fit to the iphone app that I'm 
building.

Here is my issue. I have read all your blog posts and have been looking at as 
many examples as I can, and I still don't understand this library. I don't 
understand why I have to define 500 lines of XML in order to get a tab 
navigation working.

Is there any way to simply do something like

var uiTabPages:UITabPages = new UITabPages(this, new Attributes()); // notice 
how i would love to just skip the xml attribute
uiTabPages.setTab(0, "FirstNav", optionalImage,optionalHighlightedImage);
uiTabPages.setTab(1,"SecondNav");
addChild(uiTabPages);

uiTabPages.addEventListeners(... // you get the idea

It would really ease my simple mind. Again, I'm sure your library is massively 
robust and can do a ton of stuff - but I can't use your library if I'm going to 
have to define a hundred lines of XML to get things working. It's going to be a 
big obstacle for a lot of developers like me from using your library! 

Original issue reported on code.google.com by K2xL....@gmail.com on 9 Aug 2011 at 5:49

GoogleCodeExporter commented 9 years ago
and btw, i did read 
http://madskool.wordpress.com/2011/05/27/madcomponents-sans-xml/ , but i don't 
know why you said "sans xml"... you still have to define a ton of xml :-(

Original comment by K2xL....@gmail.com on 9 Aug 2011 at 5:52

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Expressing a MadComponents layout in XML accomplished three things behind the 
scenes (that you don't need to think about):-

1. It adapts the layout to the screen size.  Different devices have different 
screen sizes.  An XML layout description is relative, not absolute.

2. It scales the layout adjusting to the pixel density of the device.  For 
example, one of my test devices is an HTC desire.  It has quite a high pixel 
density.  If it were not for the automatic scaling, the MadComponents UI 
components would be too tiny to operate.

3. It automatically adapts to screen orientation.  When the device is rotated 
between portrait and landscape - the UI is re-drawn.

These three features save you a lot of trouble.  That's why I based 
MadComponents on XML.

Original comment by doc.andr...@gmail.com on 23 Aug 2011 at 2:50

GoogleCodeExporter commented 9 years ago
Hi,
Thanks for the response.

1. When you say that it adjusts layout relative... that is nice and all but it 
doesn't HAVE to be in xml... I've been adjusting all my components based on 
screen size already.

2. I actually like this feature and this is what enticed me to use 
madcomponents (since iphone retina is different that iphone 3g and android is 
different etc) However, it did not seem to work for the navigation when i 
finally got the navigation to work (iphone retina had the nav buttons very 
small while standard resolution showed them fine). But i had to do these silly 
empty label tags in order to get them to work.

3. Not always something I want. But again it is a nice feature.

Here is my critiscm, the library is trying to be an all purpose solution by 
doing things magically for you. The problem is that the magic takes too much to 
write. I like many developers spend so much time on finding decent components 
that it ends up being more time than the development of the app. There was a 
time when animation was also a problem that took a long time to make right ... 
Tween libraries like green sock became the library that really solved 
everything (at least for me) animation wise because it has an api that is easy 
to understand. Right now, minimalcomps is one of the most popular component 
libraries... why? Not because it is more robust and can do more than 
madcomponents (i assure you it is the opposite) minimalcomps is popular because 
it is easy to implement and use. Other people have skinned and done stuff with 
it too (even tried mobile component extensions for it) But like i said, it isnt 
as feature ritch as madcomponents. ASwing (based on java swing) is another good 
example of a robust but easy to implement api.But what i would advise you think 
about supporting is figuring a very simple way for developers to integrate your 
library. All of the features you suggested above can be done without xml... 
i've done it beforenmyself.. you simply code in on specific dimension and then 
have a function to scale all of the created components to a set dimension. You 
can have methods like orient landscape or orientportriat... things that would
be simple and straightforward for a developer only trying to integrate certain 
components and not the whole shebang if that makes sense.

Hope my two cents made sense! Again i really appreciate all the work you have 
done, i just hope that you take my suggestions into consideration :)

Original comment by K2xL....@gmail.com on 23 Aug 2011 at 4:12

GoogleCodeExporter commented 9 years ago
Can you attach some sample code that demonstrates problem (2) you described, 
with the retina display?

I've made a small change to UITabPages which will be in version 0.6.  Version 
0.6 is also likely to be open source, which will make it easier for developers 
to extend MadComponents.

The following code won't work until MadComponents0_6.swc is available, but it 
should make pure actionscript tab pages easier for you:-

package
{
    import com.danielfreeman.madcomponents.*;

    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;

    public class MadComponentsPureTabs extends Sprite {

        public function MadComponentsPureTabs(screen:Sprite = null) {
            if (screen)
                screen.addChild(this);

            stage.align = StageAlign.TOP_LEFT;  
            stage.scaleMode = StageScaleMode.NO_SCALE;

            var tabPages:UITabPages = new UITabPages(this, <null/>, new Attributes(0, 0, 280, 200));
            var page0:UIButton = new UIButton(tabPages, 0, 0, "button", 0xCCFFCC, new <uint>[]);
            var page1:UISlider = new UISlider(tabPages, 0, 0, new <uint>[]);
            tabPages.attachPages([page0, page1]);
            tabPages.setTab(0, "First Label");
            tabPages.setTab(1, "Second Label");
        }
    }
}

See also my MadComponentsPurePicker2.as example (in the code repository), where 
I've written a helper class that makes creating a pure actionscript picker bank 
easier.

Original comment by doc.andr...@gmail.com on 23 Aug 2011 at 5:43