Skip to content

Commit

Permalink
step-2 Adding a View
Browse files Browse the repository at this point in the history
* Add a HelloWorldView
* Add a HelloWorldContext
* Contribute the context via the ResourceManager
  • Loading branch information
robsilv committed Jul 3, 2014
1 parent a4fd38f commit ef6eb06
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/HelloWorldExtension.as
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
package
package
{
import flash.display.Sprite;

import core.app.CoreApp;
import core.app.resources.FactoryResource;

import helloWorld.contexts.HelloWorldContext;

public class HelloWorldExtension extends Sprite
{
public function HelloWorldExtension()
{
trace("Hello World");
CoreApp.resourceManager.addResource( new FactoryResource( HelloWorldContext, "Hello World" ) );
}
}
}
27 changes: 27 additions & 0 deletions src/helloWorld/contexts/HelloWorldContext.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package helloWorld.contexts
{
import helloWorld.ui.views.HelloWorldView;
import flash.display.DisplayObject;
import core.appEx.core.contexts.IVisualContext;

public class HelloWorldContext implements IVisualContext
{
private var _view :HelloWorldView;

public function HelloWorldContext()
{
_view = new HelloWorldView();
_view.text = "Hello World";
}

public function get view():DisplayObject
{
return _view;
}

public function dispose():void
{

}
}
}
18 changes: 18 additions & 0 deletions src/helloWorld/ui/views/HelloWorldView.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package helloWorld.ui.views
{
import core.ui.components.TextArea;

public class HelloWorldView extends TextArea
{
public function HelloWorldView()
{

}

override protected function init():void
{
super.init();
_percentWidth = _percentHeight = 100;
}
}
}

0 comments on commit ef6eb06

Please sign in to comment.