Giter VIP home page Giter VIP logo

minimalcomps's Introduction

minimalcomps

Minimal ActionScript 3.0 UI Components for Flash

License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2011 Keith Peters

minimalcomps's People

Contributors

bit101 avatar makc avatar nemostein avatar pihao avatar thejustinwalsh avatar tynril avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

minimalcomps's Issues

Language Reference?

Is there an updated Language Reference available for MinimalComps, and would it be possible to place it either in the project folder or the "downloads" section?

There is one available at http://www.minimalcomps.com/documentation/ but (1) it hasn't been updated since May 2010 and (2) is not downloadable for offline viewing.

List doesn't scroll to selection

The list scroll to selection isn't working, meaning that scrolling up and down with the arrow keys, or setting the selected index directly won't work.

On line 173 of List.as, the scroll up is commented out, while the scroll down needs to be modified.

Something like this seems to work:

protected function scrollToSelection():void
{
           var numItems:int = Math.ceil(_height / _listItemHeight);
            if(_selectedIndex != -1)
            {
                if(_scrollbar.value > _selectedIndex)
                {
                    _scrollbar.value = _selectedIndex;
                }
                else if(_scrollbar.value + numItems <= _selectedIndex + 1 )
                {
                    _scrollbar.value = _selectedIndex - numItems + 1;
                }
            }
            else
            {
                _scrollbar.value = 0;
            }
            fillItems();
}

comps <label /> has no width

Just running an example in MinimalConfiguratir, and noticed when running the default example 2, input text get OVER label text within a .
This is easily fixed by adding a width to the label, like:

instead of:

I've tried it both on Flash Player 11 and Flash player 10.2

When I set items of List component, exception occurred.

I'm very thank you for these great components.
When I set items of List, I get a exception. I added a line(makeListItems) and the problem's solved.

original:
public function set items(value:Array):void
{
_items = value;
invalidate();
}

code I changed:
public function set items(value:Array):void
{
_items = value;
makeListItems();
invalidate();
}

Is it okay?
thanks. :D

PushButton mouse event on stage?

in onMouseGoDown:
stage.addEventListener(MouseEvent.MOUSE_UP, onMouseGoUp);
(and corresponding removeEventListener in onMouseGoUp).

Is there a special reason this listener is added on "stage" and not "this"?
This caused some problems for me when I had another stage mouse listener
(the button would not get the mouse up event and stay _down).

If I change this listener to register on this (the button) everything works fine.

Thanks,
Ori

HBox component measurements

Hello,

I'm enjoying the new MinimalConfigurator, but with the new version I've run into a little problem with the HBox component.
Using this Example Two on minimalcomps.com MinimalConfigurator page(http://www.minimalcomps.com/?page_id=14):

The second VBox isn't displayed at the right of the first VBox. This behaviour can be viewed on minimalcomps.com,
but it seems fine in your initial blog post (http://www.bit-101.com/blog/?p=2961/), which I imagine uses a slightly older version (maybe 0_9_9 ?)

I can resolve the issue if add an Id to the HBox node and then use the getCompById() method to reference it and call draw() on it again, but I wish there was a cleaner fix for this.

List throws error when assigning items after List creation

Hello Keith,

I've run into another issue, but not sure how severe it is.

This snippet:

var ls:List = addChild(new List()) as List;
ls.items = ['item1','item2'];

causes this error:

Exception fault: RangeError: Error #2006: The supplied index is out of bounds.
at flash.display::DisplayObjectContainer/getChildAt()
at com.bit101.components::List/fillItems()[/home/keith/minimalcomps/minimalcomps/src/com/bit101/components/List.as:135]
at com.bit101.components::List/scrollToSelection()[/home/keith/minimalcomps/minimalcomps/src/com/bit101/components/List.as:184]
at com.bit101.components::List/draw()[/home/keith/minimalcomps/minimalcomps/src/com/bit101/components/List.as:217]
at com.bit101.components::Component/onInvalidate()[/home/keith/minimalcomps/minimalcomps/src/com/bit101/components/Component.as:178]

This is using MinimalComps_0_9_10.swc, the issue is not present when I use MinimalComps_0_9_9.swc though.

All the best,
George

possible memory leak with defaultHandler in pushbutton

a click listener is added if defaultHandler is not null...
if(defaultHandler != null) { addEventListener(MouseEvent.CLICK, defaultHandler); }

thought i didn't see the listener being removed anywhere... and since weak reference is false by default maybe it should be
if(defaultHandler != null) { addEventListener(MouseEvent.CLICK, defaultHandler,false,0,true); }

I wrote a class that might help finding other memory leaks called EventManager http://k2xl.com/wordpress/2008/07/02/as3-eventmanager-class-removealllisteners/

Text.as: setTextFormat every draw() and coloring problems

Hi! Why do you call _tf.setTextFormat(_format); on every draw() call? You could use _tf.defaultTextFormat = _format once at the addChildren method. And it seems that html text rendering is not compatible with text format (I can't change a text color with a tag).

Garbage collection and Memory management?

I was wondering about the memory managment and possible memory leaks of this library.
Is it enough to just remove a display object from the stage to free up the memory??

For instance, I had a look in the PushButton.as class:

        if(defaultHandler != null)
        {
            addEventListener(MouseEvent.CLICK, defaultHandler);
        }

as far as I can see the defaultHandler is never removed from the pushbutton, and there is no way of removing it either, as the handler is an anonym function and not saved.

Wouldn't that mean that it will stay in the memory indefinitely, and cause a memory leak?

Creating list, then adding items > current list length = crash

Create a new list with a small number of items (or null):


Set the items property to a larger array:

myList.items = a;

It crashes around line 135 in fillItems() with an index out of bounds exception:


I'm assuming it's trying to reuse previous ListItems instead of creating new ones, but no check is ever made to see if they exist.

style TextArea

It would be great to able to add some formatting to the TextArea.

The below gives this error:
Error: Error #2009: This method cannot be used on a text field with a style sheet.
at flash.text::TextField/setTextFormat()
at com.bit101.components::Text/draw()
at com.bit101.components::TextArea/draw()
at com.bit101.components::Component/onInvalidate()

                    /////code to cause error/////
                    style = new StyleSheet();
        heading = new Object();
        heading.fontWeight = "bold";
        heading.color = "#000000";

        body = new Object();
        body.fontStyle = "regular";

        style.setStyle(".heading", heading);
        style.setStyle("body", body);
        //end stylesheet

        scrlTxtArea = new TextArea(this,30,310,"");
        scrlTxtArea.html = true;
        scrlTxtArea.width = 489;

        scrlTxtField = scrlTxtArea.textField;
        scrlTxtField.styleSheet = style;

Bug with height of NumericStepper

NumericStepper height should be 16 pixel, but when you add the NumericStepper into an empty Sprite, the sprite height become 100 pixel where it should be 16 pixel.

List removeItem() and removeItemAt() not removing ListItems

With the code:

this.m_combo = new ComboBox( this, 10.0, 10.0, "TestRemove", ["one", "two", "three"] );
this.stage.addEventListener( KeyboardEvent.KEY_DOWN, this._onKeyDown );

private function _onKeyDown( e:KeyboardEvent ):void
{
this.m_combo.removeItemAt( 0 );
}

It initially displays a list with the items "one", "two", and "three". When you hit a key, it's meant to remove the first item. As far as I can tell this works, but when you open the drop-down, it's now "two", "three", "three" - it's not removing the old ListItem.

This bug isn't present in v0.9.9

ComboBox throwing RangeError

With the code:
var a:Array = new Array( "hello", "world" );
var c:ComboBox = new ComboBox( this, 10, 10, "Hello world:", null );
c.items = a;

MinimalComps throws a RangeError in List.fillItems() - specifically the getChildAt() call.

The full error:
[Fault] exception, information=RangeError: Error #2006: The supplied index is out of bounds.

This wasn't present in v0.9.9. It also only throws this if you set the ComboBox items array as null in the constructor.

Various List issues

In the 0_9_10 swc:

var myList:List = new List(contents,0,0); //I have no initial items, so I leave the final arg empty
myList.addItemAt("Foo",0); //I add at 0, because i want new items to be at the top of the list.
myList.addItemAt("Bar",0); //Second time causes an index out of bounds error

RangeError: Error #2006: The supplied index is out of bounds.
at flash.display::DisplayObjectContainer/getChildAt()
at com.bit101.components::List/fillItems()[/home/keith/minimalcomps/minimalcomps/src/com/bit101/components/List.as:135]
at com.bit101.components::List/addItemAt()[/home/keith/minimalcomps/minimalcomps/src/com/bit101/components/List.as:243]

myList.removeItemAt(0); //Fails to update the view

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.