How are you instantiating the ProgrammingBasics class? Are you adding it to
the stage somehow with an addChild() after you create it?
It seems like you're using a book targeted for Flash. The Actionscript
syntax will of course be the same, but most of the patterns and practices in
it will probably make it harder to learn Flex if you're new to both of them.
I'd suggest googling for some Flex related ActionScript primers.
-Josh
On Thu, Jul 17, 2008 at 10:09 AM, brucewhealton <[EMAIL PROTECTED]>
wrote:
> Hello all,
> I'm not sure why this particular class is not working for me.
> It's part of a tutorial. I'll include the AS below. I've been
> pulling my hair out trying to figure this out. When I select debug,
> it should display in the console repeatedly the text "enter frame."
> It prints what is above that but stops before calling the event
> handler function called onEnterFrame.
> I don't know if I'm having a problem with the way I am setting
> this up or using something in relation to the event handler. It is
> part of a training on AS 3.0 with Flex, but the instructor is using
> Flex 2.0 and I have Flex 3. Please help me figure this out. The file
> is saved as ProgrammingBasics.as which matches the class name.
> Thanks so much in advance,
> Bruce
>
> The code is as follows:
> package {
> import flash.display.MovieClip;
> import com.lynda.as3et.programmingbasics.InventoryItem;
> import flash.events.Event;
>
> public class ProgrammingBasics extends MovieClip {
>
> public function ProgrammingBasics() {
> var item:InventoryItem = new
> InventoryItem("ActionScript 3.0
> Essential Training", 1000);
> trace(item.getProductName());
> trace(item.getQuantity());
> item.addItems(1000);
> trace(item.getQuantity());
> item.quantity = 100;
> trace(item.quantity);
> addEventListener(Event.ENTER_FRAME, onEnterFrame);
> }
>
> private function onEnterFrame(event:Event):void {
> trace('enter frame');
> }
>
> }
> }
>
>
> Below this we have the Inventory.as Actionscript class. I don't think
> this would be needed because it seems that everything up to
> addEventListener works but here it is anyway. Please ignore what is
> below if it is not necessary.
>
> package com.lynda.as3et.programmingbasics {
>
> public class InventoryItem {
>
> private var _productName:String;
> private var _quantity:Number;
>
> public function get quantity():Number {
> return _quantity;
> }
>
> public function set quantity(value:Number):void {
> if(value < 0) {
> value = 0;
> }
> _quantity = value;
> }
>
> public function InventoryItem(productName:String,
> quantity:Number) {
> _productName = productName;
> _quantity = quantity;
> }
>
> public function getProductName():String {
> return _productName;
> }
>
> public function getQuantity():Number {
> return _quantity;
> }
>
> public function addItems(quantity:Number):void {
> _quantity += quantity;
> }
> }
> }
>
>
>
> ------------------------------------
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
> Links
>
>
>
>
--
"Therefore, send not to know For whom the bell tolls. It tolls for thee."
:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]