Reusing functions in ActionScript Classes

I have an MXML Component which I am using as a Base Class for
other components that share similar functionality. The Extended
Classes use some of the same functions. Those functions perform no
logic in the Base Class, but are called by Event Listeners in the
Base Class. Right now, I have those functions setup as protected
functions, and I am overriding them in the Extended Classes, but
I'm thinking this isn't the best way to do this. Should I use an
Interface???
Any suggestions would be greatly appreciated...
Thank you.

"Ansury" <[email protected]> wrote in
message
news:gacbks$1b0$[email protected]..
> Yes, I was referring to having your inheriting classes
implement the
> interface
> (still a pain in the rear), but like I said you have to
remember to add
> the
> interface to each class anyway... It's probably not
worth worrying about
> it at
> this stage of AS's life.
>
> Regarding abstract classes in current AS, that's
interesting. But I
> usually
> avoid fancy hacks that are likely to confuse new people
looking at or
> maintaining my code. Maybe it's not the coolest strategy
but many people
> do
> appreciate it when you omit that fancy fancy automagic
tricky code and go
> with
> something much easier to understand or maintain from the
outsider's
> perspective.
>
> Also I'm not sure what that method gets you over simply
throwing an
> exception
> in a function that must be implemented by an extending
class. I guess
> this:
> "We can make a real abstract class that implements none,
some, or all of
> an
> interface?s methods". (Although really you can still do
that with the
> common
> exception throwing method.) I suppose this is useful if
you're making
> lots of
> complex hierarchies and leveraging polymorphism alot and
so on, but that
> type
> of design tends to get trickier than it's worth in
practice.
>
> And if this gave you a compile time error that might be
cooler, but it
> looks
> like it's still just generating a run-time error.
Anyway, enough rambling
> on.
>
> Cool trick, but I'll wait until Adobe decides to support
abstract natively
> and
> it becomes common knowledge - maybe with Flex 4 and
Flash 10?
Probably too soon after As3 and ECMA parted ways

Similar Messages

  • Making all named member functions of an actionscript class avlbl to ExternalInterface automatically

    Making all named member functions of an actionscript class available to ExternalInterface automatically :
    I am trying to custom-tweak the as3 compiler to generate instructions to register all functions in the ClassDefinitionNode to ExternalInterface.
    I guess the operation will have to be performed somwhere between the analyze sequences of the compiler, but am not quite able locate where.
    I have this codelet (executed for all constructors, for every non-constructor)
                    ArgumentListNode argListNode = new ArgumentListNode(
                            new LiteralStringNode(
                                    NodeMagic.getClassName(clNode)+ "." + functionCommonNode.identifier.name), 0);
                    //argListNode.items.add(new LiteralNullNode());
                    argListNode.items.add(new IdentifierNode(functionCommonNode.identifier.name, 0));
                    MemberExpressionNode mnode = new MemberExpressionNode(new IdentifierNode("ExternalInterface", 0),
                            new InvokeNode("addCallback",
                                    argListNode),0);
                    mnode.ref = new ReferenceValue(cx, null, "ExternalInterface", ObjectValue.intrinsicNamespace); //NOT TOO SURE ABOUT THIS ONE
                    constructor.body.items.add(mnode
    Any assistance would be appreciated!
    Thanks!

    Making all named member functions of an actionscript class available to ExternalInterface automatically :
    I am trying to custom-tweak the as3 compiler to generate instructions to register all functions in the ClassDefinitionNode to ExternalInterface.
    I guess the operation will have to be performed somwhere between the analyze sequences of the compiler, but am not quite able locate where.
    I have this codelet (executed for all constructors, for every non-constructor)
                    ArgumentListNode argListNode = new ArgumentListNode(
                            new LiteralStringNode(
                                    NodeMagic.getClassName(clNode)+ "." + functionCommonNode.identifier.name), 0);
                    //argListNode.items.add(new LiteralNullNode());
                    argListNode.items.add(new IdentifierNode(functionCommonNode.identifier.name, 0));
                    MemberExpressionNode mnode = new MemberExpressionNode(new IdentifierNode("ExternalInterface", 0),
                            new InvokeNode("addCallback",
                                    argListNode),0);
                    mnode.ref = new ReferenceValue(cx, null, "ExternalInterface", ObjectValue.intrinsicNamespace); //NOT TOO SURE ABOUT THIS ONE
                    constructor.body.items.add(mnode
    Any assistance would be appreciated!
    Thanks!

  • How to call setter Method of ActionScript class with in a Flex Application

    Hi
    I have Action class as shown :
    public class MyClass
    private var name:String 
    public function get name():String {
        return _initialCount;
    public function set name(name:String):void {
        name = name;
    Now please let me know how can i access this Action class under my Flex Application and call the setter Method of it to set the value for the name .
    For example on entering some data in a TextInput and  click of a submit Button , on to the Event Listener , i want to call the set name method of my ActionScript class .
    Please share your ideas on this .

    Thanks  Gordon for your resonse .
    Say for example my Action class is like this :
    public class MyClass
    private var name:String 
    public function get name():String {
        return name;
    public function set name(name:String):void {
        name = name;
    This is inside the MXML
    I know this way we can do it
    public var myclass:MyClass = new MyClass();
    myclass.name="Kiran";
    Now my query is can we do in this way also ??
    myclass.set name(SomeTextInput.text);
    Please share your views on this , waiting for your replies .
    Thanks in advance .

  • Accessing function with a Class

    Hi
    I have a mp3player that I want to include in another flash
    movie. The mp3player is a movie clip with an actionscript class
    attached to it. I can use the mp3 player fine and it works
    perfectly, but I have a slight problem when I want to change one of
    the variables in the class. The class contains get and set methods
    to change the playlist etc, and the only way I can think of to
    access them is to create a new player object and call the functions
    on that object. This kind of works- I can call the function and it
    resets the playlist value, but for some reason the constructor in
    the class is called straight afterwards and the playlist reverts
    back to the default. I have a feeling this has something to do with
    the fact that the actionscript class is attached to the player
    movieclip, but I'm not an expert at using OO design in flash, and
    so can't be certain.
    I hope someone can help- I'm sorry I can't post any of the
    code in the class, but it's a file I bought and the copyright won't
    allow me to do so.
    Thanks in advance
    S

    It's hard to attemp an answer when you don't supply any code.
    Do you have access to the .fla file? What variables are are
    involved? What are the instance names.? Are you working with the
    .swf file?
    If you are wrking with a .swf perhaps there is a LoadVariable
    which is loading the play list from a text file which is probably
    located in some folder under the SWFs root folder.on your system.
    Check there and if so, let me know and I'll try to assist.

  • How to set an actionscript class runnable + some question?

    Dear all,
      i am new to actionscript (Flex 3).
      i am from java camp and i want to achive some java-style functionality in actionscript,and hope you can help me:
      1. how to set an actionscript class runnable??
          in java, i just add a "public static void main(String[] args)" method which will be the program entry point. (IDE, right click the class and click run)
          i can't set a plain, ordinary actionscript runnable in flex builder.
          To test the class, i have to create an mxml (which in turn invoke the testing class) and it be runnable in the flex builder 3.
          any other way to ease the testing?
       2. it there any good 3rd party library for datatype conversion ? (e.g. string <> date, the build-in DateFormatter don't accept milliseconds)...
           it seems actionscript come with limited such kind of utility function
       3. in a custom mxml component, which contains several controls (say testboxes, comboboxes)...etc,
           for information hiding/prevent others to change the child controls in the custom component, how can i hide the child control, not allow
           other code to access the child by  "Component.textbox1"....any scope modifier, e.g. protected, private...etc in mxml?
       thank you.
    ppk luk

    Hi Alex,
      for question 3:
      i just wondering if it is ok or not for better code/validation.....(and it follow the good
    information hiding principle?)
      if i write the component in actionscript only, i can set the child control with scope modifier
    'private' or 'protected'..so that the component user can't just use the dot syntax to gain
    access to the child control,
    e.g. MyComponent.childControlTextInputBox.value = "A";...
    i want to force user to use MyComponent.setInputBoxValue("A")...
    (e.g. in this method, i can do some checking/validate before passing to the textbox)
      this can enforce the data consistency in my custom UI component...
      there is no way to achieve the same effect in MXML?
    (e..g <mx:TextInput id="privateChildControl" accessScope="private" .../>)
      thank you..

  • WebService and ActionScript class

    Hi,
    I am trying to create an actionscript class to use it in my
    mxml component.
    I have the floowing code which works perfectly.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application creationComplete="HTTPdecision.send()"
    xmlns:mx="
    http://www.adobe.com/2006/mxml"
    width="870">
    <mx:Script>
    <![CDATA[
    import mx.rpc.events.ResultEvent;
    import com.sourcepulse.com.dtRulesClass;
    private var endURI:XML;
    private var URI:XMLList;
    private function setURI(event:ResultEvent):void
    endURI = event.result as XML;
    URI = new XMLList(endURI.endpoint.webservice.location);
    Test.endpointURI= URI.toString();
    ]]>
    </mx:Script>
    <mx:HTTPService id="HTTPdecision"
    url="../XML/endpointURI.xml" resultFormat="e4x"
    result="setURI(event)" />
    <mx:WebService service="amazon" port="amazonSOAP"
    id="Test"
    wsdl="
    http://localhost:9081/ezbuyer/amazon/services/amazonSOAP/wsdl/amazon.wsdl"
    >
    <mx:operation name="getISBNDetails">
    <mx:request xmlns="">
    <isbnSearchRequest>
    <bookName>{txtBookName.text}</bookName>
    <category>{txtCategory.text}</category>
    </isbnSearchRequest>
    </mx:request>
    </mx:operation>
    </mx:WebService>
    <mx:Panel x="100" y="100" width="600" height="500"
    layout="absolute"
    title="Amazon WebService">
    <mx:VBox height="400">
    <mx:VBox>
    <mx:Form width="400" height="145" autoLayout="true">
    <mx:FormHeading label="Specify the following:"/>
    <mx:FormItem width="307" label="BookName :">
    <mx:TextInput id="txtBookName"/>
    </mx:FormItem>
    <mx:FormItem width="308" label="Category :">
    <mx:TextInput id="txtCategory" />
    </mx:FormItem>
    <mx:FormItem width="312">
    <mx:Button label="Test"
    click="Test.getISBNDetails.send()"/>
    </mx:FormItem>
    </mx:Form>
    </mx:VBox>
    <mx:VBox>
    <mx:Form width="400" height="122" autoLayout="true">
    <mx:FormHeading label="Book Details:"/>
    <mx:FormItem width="307" label="ISBN :">
    <mx:Text text="{Test.getISBNDetails.lastResult.isbn}"
    />
    </mx:FormItem>
    <mx:FormItem width="308" label="Author :">
    <mx:Text text="{Test.getISBNDetails.lastResult.author}"
    />
    </mx:FormItem>
    </mx:Form>
    </mx:VBox>
    </mx:VBox>
    </mx:Panel>
    </mx:Application>
    Now instead of binding the input from the textboxes directly
    as in the above code
    <mx:request xmlns="">
    <isbnSearchRequest>
    <bookName>{txtBookName.text}</bookName>
    <category>{txtCategory.text}</category>
    </isbnSearchRequest>
    </mx:request>
    I created an actionscript class
    package com.xxxx.com
    public class simpleTest
    //Instance Variables
    private var bookName:String;
    private var category:String;
    public function simpleTest()
    function getBookName():String {
    return bookName;
    function setBookName(bookName:String):Void {
    this.bookName = bookName;
    function getCategory():String {
    return category;
    function setCategory(category:String):Void {
    this.category = category;
    How can I use this ActionScript class to use in
    <bookName>{txtBookName.text}</bookName>.
    Thanks in advance.

    I think you're close to achieving what you want... first I
    would change your getter and setter methods just a bit to make them
    properties. Second add the [Bindable] meta tag in front of one of
    each of the group of properties (i.e. you don't need it in front of
    both the get and set method, just one of them).
    i.e.
    [Bindable]
    public function get category():String {
    return category;
    public function set category(value:String):void{
    category = value;
    then in your mxml you can "bind" to each property you've
    defined in the class. so if you create a new instance of your
    simpleTest class called "test" you could do the following:
    <mx:Label text="{test.category}" />

  • Sending tile messages from ActionScript classes

    The majority of my code resides in Actionscript classes, not in the MXML tiles themselves.  Do you have an example of an Actionscript class with (or without?) a reference to the tile sending/receiving a message to the composite application?
    Thanks!

    You will have to pass in the MosaicApp reference if you want to actually have the class register a listener or send messages, something as simple as this:
        import com.adobe.mosaic.om.interfaces.IApplication;
        import com.adobe.mosaic.om.events.Message;
        public class Sample
            private var mosaicApp : IApplication;
            public function Sample(app:IApplication)
            public function sendIt() {
                var msg:Message = new Message("someNamespace", "someEvent", "Hello tile");
                mosaicApp.sendMessage(msg);
    Lee Burch

  • Accessing MXML ArrayCollection from ActionScript class?

    I have an MXML file that has an arraycollection for my Tree
    component. I am overriding the updateDisplayList function in order
    to add lines to all of my nodes in the Tree.. however I can't seem
    to figure out how to access that ArrayCollection from inside the
    actionscript class?
    I have tried the methods used to pass variables between two
    MXML files (like a popup window - which I have used in the past and
    it works great).
    My actionscript class code is almost identical to this
    example here:
    http://www.iepl.net/treeControlSample/treeControlSample.html
    In the above example the data is static, but my data is going
    to change sometimes and I need access to the entire dataProvider
    (ArrayCollection) in order to make the lines work right.. this has
    been very frustrating for me! :)
    if anyone knows of a better way to achieve gettign lines to
    the siblings in a Tree.. please let me know!
    Any help would be super duper awesome!

    I have found the solution to this. My problem was similar to
    the one cheftimo was having in this post:
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=60&catid=585&threadid =1367784&enterthread=y
    The answer is to import mx.core.Application into the
    component you are trying to access the variable from and then call
    it by using 'Application.application.<var name>'
    Thanks to Greg Lafrance!

  • Flex RPC mapping Java nested classes to ActionScript classes

    We are calling a Java method in our project using
    RemoteObject the value returned by the java method is a ArrayList
    containing instances of a class say ParentClass with some nested
    classes.
    The structure of ParentClass(Java) is something like this
    class ParentClass {
    //some primitives
    private ChildClassA childAInstance;
    private ChildClassB childBInstance;
    //getters setters
    We have created similar class structure on the ActionScript
    side, the ActionScript classes(ParentClass,ChildClassA
    ,ChildClassB) have been properly annotated with the [RemoteClass]
    metadata tag,
    The problem is that though i'm getting the primitive data
    members of the ParentClass through RPC in my corresponding AS
    ParentClass class i'm getting an runtime exception trying to access
    ChildClassA,ChildClassB members.
    Am i missing something, exactly the same scenario is
    mentioned in this article
    http://www.adobe.com/devnet/flex/articles/complex_data.html
    But the Object.registerClass method mentioned in the tutorial
    is giving me compilation error, the sample code attached with the
    article is corrupt zip too.
    Please help me out on this

    JAXB will create classes from an XML schema, SAX is a parser library and JAXP is a library of XML a bunch of XML tools.
    I don't care for JAXB too much. I would skip it and go right to the JAX-RPC spec (WebServices).

  • How to load function from derived class from dll

    Dear all,
    how to access extra function from derived class.
    for Example
    //==========================MyIShape.h
    class CMyIShape
    public:
    CMyIShape(){};
    virtual ~CMyIShape(){};
    virtual void Fn_DrawMe(){};
    // =========== this is ShapRectangle.dll
    //==========================ShapRectangle .h
    #include "MyIShape.h"
    class DLL_API ShapRectangle :public CMyIShape
    public:
    ShapRectangle(){};
    virtual ~ShapRectangle(){};
    virtual void Fn_DrawMe(){/*something here */};
    virtual void Fn_ChangeMe(){/*something here */};
    __declspec (dllexport) CMyIShape* CreateShape()
    // call the constructor of the actual implementation
    CMyIShape * m_Obj = new ShapRectangle();
    // return the created function
    return m_Obj;
    // =========== this is ShapCircle .dll
    //==========================ShapCircle .h
    #include "MyIShape.h"
    class DLL_API ShapCircle :public CMyIShape
    public:
    ShapCircle(){};
    virtual ~ShapCircle(){};
    virtual void Fn_DrawMe(){/*something here */};
    virtual void Fn_GetRadious(){/*something here */};
    __declspec (dllexport) CMyIShape* CreateShape()
    // call the constructor of the actual implementation
    CMyIShape * m_Obj = new ShapCircle();
    // return the created function
    return m_Obj;
    in exe there is no include header of of ShapCircle and ShapRectangle 
    and from the exe i use LoadLibrary and GetProcAddress .
    typedef CMyIShape* (*CREATE_OBJECT) ();
    CMyIShape*xCls ;
    //===================== from ShapeCircle.Dll
    pReg=  (CREATE_OBJECT)GetProcAddress (hInst ,"CreateShape");
    xCls = pReg();
    now xCls give all access of base class. but how to get pointer of funciton Fn_GetRadious() or how to get access.
    thanks in advance.

    could you please tell me in detail. why so. or any reference for it. i love to read.
    i don't know this is bad way.. but how? i would like to know.
    I indicated in the second sentence. Classes can be implemented differently by different compilers. For example, the alignment of member variables may differ. Also there is the pitfall that a class may be allocated within the DLL but deallocated in the client
    code. But the allocation/deallocation algorithms may differ across different compilers, and certainly between DEBUG and RELEASE mode. This means that you must ensure that if the DLL is compiled in Visual Studio 2010 / Debug mode, that the client code is also
    compiled in Visual Studio 2010 / Debug mode. Otherwise your program will be subject to mysterious crashes.
    is there any other way to archive same goal?
    Of course. DLL functionality should be exposed as a set of functions that accept and return POD data types. "POD" means "plain-ole-data" such as long, wchar_t*, bool, etc. Don't pass pointers to classes. 
    Obviously classes can be implemented within the DLL but they should be kept completely contained within the DLL. You might, for example, expose a function to allocate a class internally to the DLL and another function that can be called by the client code
    to free the class. And of course you can define other functions that can be used by the client code to indirectly call the class's methods.
    and why i need to give header file of ShapCircle and shapRectangle class, even i am not using in exe too. i though it is enough to give only MyIShape.h so with this any one can make new object.
    Indeed you don't have to, if you only want to call the public properties and methods that are defined within MyIShape.h.

  • Mapping existing actionscript class (mx.collections.SortField) to java

    Hi,
    I would like to map the existing SortField actionscript class on a SortField class on my java backend.
    Is it possible to map an actionscript class from standard flex API to a java class? If so, how?
    Thanks

    Yeah, there is something awry with your mapped classes.  You don't use the java source files to map your classes, you use AS3
    classes that are designated to which classes they map to on the backend.  Observe..
    package shared.servicevos
       import flash.events.EventDispatcher;
       import flash.events.IEventDispatcher;
       [Bindable]
       [RemoteClass(alias="amf.ShopperVO")]
       public class ShopperVO
           public var shopperId:int;
           public var shopperLocation:String;
           public var shopDate:Date;
           public var shopperAddress:Address
    If you notice the the metadata beginning with "RemoteClass", I am telling Flex "when you see an object that comes in with this type "alias" it is should be made into a ShopperVO".  On the backend, I have a folder with a directory structure of /amf and it contains a ShopperVO.java class.
    P.S This isn't exactly the setup I am working with cause I am using php, but the ideas are the same.

  • Converting MXML Components to ActionScript Classes

    I'm in the process of converting most (if not all) of my MXML
    components to Action Script classes. I've found this is easy, and
    doesn't require a lot of extra code when extending a simple
    container or control. However, several of my MXML components have
    several nested containers and controls - i.e. a component that
    contains several Labels, a ComboBox, a TextInput, a Button, and a
    DataGrid, plus several other containers needed for layout. To code
    the layout of all these containers and controls using MXML, it uses
    about 16 lines of code. To code the layout in ActionScript, it
    takes about 50+ lines of code (see attached).
    I'm just wondering if there are any best practices for
    creating ActionScript classes that include several (or even A LOT
    OF) containers and controls. It's very easy to layout in MXML, and
    is more visibly pleasing to look at and understand, but I feel it
    is best practice to code components as ActionScript classes. I know
    I should be using MVC, but it's a little late to rewrite the entire
    application now.
    Any thoughts?

    I can't specifically speak to how to write layout code in
    ActionScript, but you can look at the generated code that Flex
    creates to get an idea of how Flex does it. When you compile an
    app, the Flex compiler takes your MXML input and converts it to
    ActionScript classes before compiling the entire set of classes
    into a SWF. Because of this, you can look at the interim
    ActionScript code.
    You do this by setting the keep-generated-actionscript
    compiler option to true and looking in the /generated directory.
    hth,
    matt horn
    flex docs

  • How to reference a Constants.as actionscript in another actionscript class

    Hi,
    How can I use constant variables from a Constatnst file (.as file) in another actionscript class?
    Thanks.

    What id I don't have the Constants.as not defined as a class.
    Constants.as
    public static const BASE_NAME = "ABC";
    public static const EQUIPMENT_NAME = "777";
    I can't import is file as its not a class file, right?
    So, how can I access BASE_NAME, etc.
    In a mxml file, I use the <mx:Script source="/../Constants.as"/>
    but how about in an actionscript class file.

  • Browser not responding when  there is a Exception in ActionScript class

    Hi ,
    I am trying to debug my Application , so under the ActionScript lass i am using some
    trace print messages .
    But the Problem is that when ever there is an Exception on to my ActionScript class , the browser is not responding
    Means i need to manually close the Browser by killing the process itself .
    I guess there is something problem with the FlashPlayer tat is runnning the swf file .
    could anybody please let me know how to resolve this issue .

    When there is an exception, you need to manually close the browser by either clicking on the close button of browser or stop button of the debugger. There is another button in debugger which allows you to ignore the exception and resume execution. It looks like a play button with green color.

  • How to Access MXML components  from ActionScript class

    Hi ,
    I am having a Application Conataner , in which i am having a Form Container with some Label in it .
    This is some thing similar to this as shown :
    <Mx:Application>
    <Mx:Form>
    <Mx:Label text="Hello world"/>
    </Mx:Form>
    </Mx:Application>
    Can any body please let me know how can i access this Form's Label , from an ActionScript class .
    catch(error:*)
    // Here i want to access these Objects and set data to that Label .
    Basically My requirement is that iinside the catch block of my ActionScript class , i want to set some text to the Label , Please
    let me know if this is possible or not also ??
    Waiting for your Replies .

    Hi these both are not same these refer to different one...
    Well let me explain...
    Application.application.myCustomComp.myLabel.text = "sometext"; sets the label "myLabel" which is present inside your customcomponent(which is in main application).
    Application.application.myLabel.text = "sometext"; sets the label "myLabel" which is present directly inside your main application.
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:Label id="myLabel"  text=""/> // So inorder to set the label(myLabel) present here you will use directly the 2nd line of code.
    <mx:CustomComp id="myCustomComp" /> // So inorder to set the label(myLabel) present inside this component you use 1st line of code.
    </mx:Application>
    Hope now its clear.
    If this post answers your question or helps, please kindly mark it as such.
    Thanks,
    Bhasker Chari

Maybe you are looking for

  • ITunes network connection has been reset: Anyone know the meaning?

    Within the past 2 days I have started receiving a "Network connection has been reset" error message when trying to purchase new apps or updating already purchased apps. Does anyone have better insight than I into its meaning and purpose? Thanks!

  • Problems panel no longer reporting errors until I run

    I've been using Flash Builder and just the other day it stopped reporting errors in the problem panel for any projects until I try to run them.. saving is no longer enough. I know this isn't an issue of external files because I'm in class and my neig

  • [SOLVED] Gnome 3.4 - Super+R to launch terminal

    I added a new shortcut to "gnome-terminal" as Ctrl+Alt+T on keyboard shortcuts configuration program. However, I can only set it to <C-A-t> (control+alt+t), and not to Super+R, or Super+T, or Super+ENTER. It used to work on Gnome 3.2? Should I report

  • Entry VEHICLE missing in table COM_SE_BUSOBJ

    Hi Experts, I'm facing an issue in SAP VMS (Vehicle Management System). If I click on the "Find" option in VELO transaction then list of vehicles will be displayed but system throwing following error" Entry VEHICLE missing in table COM_SE_BUSOBJ" Plz

  • Songs skip when volume changed

    I have a 8GB iPod nano (3rd generation). I have only had it since August (really wishing i had waiting to replace my old iPod a couple more months so I could have gotten the new nano). Today I started having a problem with the sound on my iPod. When