2 Replies Latest reply on Sep 9, 2009 12:21 PM by Jens Wegar

    extending spark.components.Application

    Jens Wegar Level 1

      I'm trying to extend the spark.components.Application component, but I'm getting the following compiler error when I actually try to use my subclass:

       

      Could not resolve <s:layout> to a component implementation.

       

      I have the namespaces set up as per the default when you create a new spark component. Anyone know what I'm doing wrong? Below is the code I'm using:

       

      In the subclass (WidgetBase.as)

      package platform.plugins
      {
           import spark.components.Application;

       

          public class WidgetBase extends Application
                                   implements IWidgetBase
           {
               public function WidgetBase()
               {
                   super();
               }
              
               public function getServiceClass(name:String):*
               {
                   trace("should fetch service class = "+name);
                   return null;
               }
           }
      }

       

       

      Using WidgetBase in MXML:

      <?xml version="1.0" encoding="utf-8"?>
      <plugins:WidgetBase xmlns:plugins="platform.plugins.*"
                          xmlns:fx="http://ns.adobe.com/mxml/2009"
                          xmlns:s="library://ns.adobe.com/flex/spark"
                          xmlns:views="prospects.views.*">

       

          <s:layout>
              <s:BasicLayout />
          </s:layout>
         
          <views:ProspectInfo left="50" top="100" />
      </plugins:WidgetBase>

       

      So for some reason the compiler doesn't find the s:layout implementation. It does however find other spark components, such as s:Button, s:CheckBox etc. Why, is the question?