arjanpetersen
02-17-2009, 01:49 PM
Hi,
Hopefully somebody can help me with this. It drives me crazy:
I am trying to implement mvcs blueprint but i have problems with implementing the components mxml. I have this components mxml
<?xml version="1.0" encoding="utf-8"?>
---Components.mxml
<Components
xmlns="com.tamsite.service.*"
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:controller="com.tamsite.controller.*"
xmlns:model="com.tamsite.model.*">
<GetSiteContentService id="getSiteContentService" urlPrefix="http://localhost/amfphp/services/"/>
<controller:Controller id="controller" getSiteContentService="{getSiteContentService}"/>
</Components>
----- Components.as
package com.tamsite.service
{
import com.tamsite.controller.IController;
import flash.events.Event;
import mx.core.UIComponent;
[Bindable]
public class Components extends UIComponent
{
/** Reference to singleton instance of this class. */
private static var _instance:Components;
public var controller:IController;
public var getSiteContentService:IGetSiteContentService;
public function Components()
{
super();
_instance = this;
dispatchEvent(new Event("instanceChanged"));
}
[Bindable("instanceChanged")]
public static function get instance():Components
{
return _instance;
}
}
}
--- controller.as
public class Controller extends EventDispatcher implements IController
{
[Bindable]
public var statusLabel:Label;
public var getSiteContentService : IGetSiteContentService;
private var _activeOperations:ArrayCollection = new ArrayCollection;
//////////////////////////////////////
// IController Implementation
//////////////////////////////////////
public function getAgenda():ICollectionView
{
var dataProvider:ArrayCollection = new ArrayCollection();
performOperation(getSiteContentService.loadAgenda( dataProvider));
return dataProvider;
}
--- Icontroller.as
package com.tamsite.controller
{
import mx.collections.ICollectionView;
import mx.controls.Label;
public interface IController
{
function set statusLabel(l:Label):void;
function getAgenda():ICollectionView;
}
}
--- main.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
xmlns:view="com.tamsite.view.*" xmlns:service="com.tamsite.service.*">
<mx:Resize id="resize" />
<service:tamsiteComponents id="components"/>
<mx:Panel width="90%" height="90%" layout="absolute" x="44.5" y="10" styleName="MainPanel">
<mx:Canvas width="95%" height="518" horizontalCenter="0">
<mx:HBox x="10" y="92" width="100%" height="100%">
<view:TamNavigationAccordion
resizeToContent="true"
resizeEffect="{resize}"
x="10" y="77"
openDuration="500"/>
<mx:VBox width="100%" height="100%">
</mx:VBox>
</mx:HBox>
<mx:Image width="153" source="images/TAMlogo.png" scaleContent="true" height="74" x="10" y="10"/>
</mx:Canvas>
</mx:Panel>
<mx:Style source="Skin.css"/>
</mx:Application>
The main problem is the component.mxml. I get the message:
1119: Access of possibly undefined property getSiteContentService through a reference with type static com.tamsite.controller:IController.
I don't what i'm doing wrong. I used the reviewtube app from berkovitz as example. Any ideas?
Hopefully somebody can help me with this. It drives me crazy:
I am trying to implement mvcs blueprint but i have problems with implementing the components mxml. I have this components mxml
<?xml version="1.0" encoding="utf-8"?>
---Components.mxml
<Components
xmlns="com.tamsite.service.*"
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:controller="com.tamsite.controller.*"
xmlns:model="com.tamsite.model.*">
<GetSiteContentService id="getSiteContentService" urlPrefix="http://localhost/amfphp/services/"/>
<controller:Controller id="controller" getSiteContentService="{getSiteContentService}"/>
</Components>
----- Components.as
package com.tamsite.service
{
import com.tamsite.controller.IController;
import flash.events.Event;
import mx.core.UIComponent;
[Bindable]
public class Components extends UIComponent
{
/** Reference to singleton instance of this class. */
private static var _instance:Components;
public var controller:IController;
public var getSiteContentService:IGetSiteContentService;
public function Components()
{
super();
_instance = this;
dispatchEvent(new Event("instanceChanged"));
}
[Bindable("instanceChanged")]
public static function get instance():Components
{
return _instance;
}
}
}
--- controller.as
public class Controller extends EventDispatcher implements IController
{
[Bindable]
public var statusLabel:Label;
public var getSiteContentService : IGetSiteContentService;
private var _activeOperations:ArrayCollection = new ArrayCollection;
//////////////////////////////////////
// IController Implementation
//////////////////////////////////////
public function getAgenda():ICollectionView
{
var dataProvider:ArrayCollection = new ArrayCollection();
performOperation(getSiteContentService.loadAgenda( dataProvider));
return dataProvider;
}
--- Icontroller.as
package com.tamsite.controller
{
import mx.collections.ICollectionView;
import mx.controls.Label;
public interface IController
{
function set statusLabel(l:Label):void;
function getAgenda():ICollectionView;
}
}
--- main.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
xmlns:view="com.tamsite.view.*" xmlns:service="com.tamsite.service.*">
<mx:Resize id="resize" />
<service:tamsiteComponents id="components"/>
<mx:Panel width="90%" height="90%" layout="absolute" x="44.5" y="10" styleName="MainPanel">
<mx:Canvas width="95%" height="518" horizontalCenter="0">
<mx:HBox x="10" y="92" width="100%" height="100%">
<view:TamNavigationAccordion
resizeToContent="true"
resizeEffect="{resize}"
x="10" y="77"
openDuration="500"/>
<mx:VBox width="100%" height="100%">
</mx:VBox>
</mx:HBox>
<mx:Image width="153" source="images/TAMlogo.png" scaleContent="true" height="74" x="10" y="10"/>
</mx:Canvas>
</mx:Panel>
<mx:Style source="Skin.css"/>
</mx:Application>
The main problem is the component.mxml. I get the message:
1119: Access of possibly undefined property getSiteContentService through a reference with type static com.tamsite.controller:IController.
I don't what i'm doing wrong. I used the reviewtube app from berkovitz as example. Any ideas?