A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: If the target object has a property called source?

  1. #1
    Senior Member
    Join Date
    Apr 2000
    Location
    Minneapolis
    Posts
    2,127

    If the target object has a property called source?

    From a component I am working with.....
    "If the target object has a property called source, which is used to set the path and file name of the media file to be loaded, then the list component will automatically set that source property."

    I am a little confused by what this really means.
    keeping it very simple if I had a basic mc how do I give that a property called source?

    mark

  2. #2
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    You could define a class, and use that as a getter setter, or you could define an object and give it that property. What are you essentially going for here?

  3. #3
    Senior Member
    Join Date
    Apr 2000
    Location
    Minneapolis
    Posts
    2,127
    Hi,
    thanks for the reply
    I am using a component and trying to capture the string that is output when a button is clicked.
    The string is I believe contained in the <content> tags of the xml file.
    the component site is here..
    http://www.jumpeyecomponents.com/Fla...Play-List-285/
    I am attaching FLA and AS files for what I tried with the code below, and including the xml and the component help PDF file.

    This is what I tried
    PHP Code:
    // created MC.as with property source
    package {
        
    import flash.display.MovieClip;
     
        public class 
    MC extends MovieClip {
     
            public var 
    source:String

        }
    }

    //then in my FLA file with the component
    var mc = new MC();
    mc.source "no success";

    this.addEventListener(Event.ENTER_FRAME,EnterFrame );
    function 
    EnterFrame(event:Event):void {
        
    trace(mc.source);//should return value in content line of xml
    //when button is clicked
    }

    //mc is set as the _targetInstanceName in the
    //properties of the scroller component. 
    Eventually I want to use this component with the dynamic streaming video player I made from some tutorials at Adobe.

    Thanks for any help
    Mark
    Last edited by mgason; 12-08-2009 at 02:01 PM.

  4. #4
    Senior Member
    Join Date
    Apr 2000
    Location
    Minneapolis
    Posts
    2,127
    bump, still looking for help

  5. #5
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    First, I'd like to apologize for the delay, new dad, and things were a bit rough, but anyway, here we go.

    From what I'm understanding you want to mouse over the items in the playlist and when you do, you want it to trace out the content within the <content> tag for that XML element, right?

    If so, delete the code you current have on your main timeline, you don't even need the MC class, and paste this code on your main timeline.

    Code:
    import JCPlayListEvent;
    playlist.addEventListener(JCPlayListEvent.XML_LOAD, contLoadHdl);
    function contLoadHdl(evt: JCPlayListEvent):void {
    	trace("content loaded " + evt);
    playlist.addEventListener(JCPlayListEvent.ITEM_ROLL_OVER, rollOverHdl);
    }
    
    function rollOverHdl(evt: JCPlayListEvent):void {
    	trace("ITEM_ROLL_OVER event on item: " + evt.item);
    	trace(evt.item.content);
    }

  6. #6
    Senior Member
    Join Date
    Apr 2000
    Location
    Minneapolis
    Posts
    2,127
    Hi,
    First congratulations on being a new dad!!!!

    I took your code, changed it to the select event, plugged it into my actual streaming video project and in about 15 minutes had everything working as wanted.
    The list now switches dynamic streams in the video player, I was starting to think that was a pipe dream.
    I had been stuck for ages.

    I can not thank you enough.
    when the project goes live I will send you a link, would love to hear your opinion.

    Mark

  7. #7
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    Thank you very much, and always happy to help. And feel free to shoot me the link at jonathon.weeks@gmail.com

    Thanks.

  8. #8
    Senior Member
    Join Date
    Apr 2000
    Location
    Minneapolis
    Posts
    2,127
    sorry back to bug you again, hopefully this is easy.

    I have everything working with the click.
    I have a textfield named info_txt which displays the info tag of the xml
    when a button is clicked.
    PHP Code:
    flip_mc.videoInfoSide_mc.info_txt.text evt.item.info
    I am trying to get the first "info" item in the xml to display automatically.
    I read up before bugging you, this was my best effort which does not work
    PHP Code:
    var myItem:Object = new Object();
    myItem playlist.getItemAt(1);
    trace(myItem.info " FIRST ITEM")
    info_txt.text myItem.info
    hope you are getting some sleep ;-)
    Mark

  9. #9
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    Shoot me your source file, and I'll get it hammered out. I have an idea already. And nope, no sleep, LOL.

  10. #10
    Senior Member
    Join Date
    Apr 2000
    Location
    Minneapolis
    Posts
    2,127
    I have a trimmed down source file.
    Comments in the code on the problem.
    I have included all the files necessary, tween classes, xml etc.
    I have to email you the zip file it is slightly too big for flashkit

    Its fairly simple really.
    One thing that may be confusing, inside the flip_mc you have 2 other mc's
    listSide_mc
    videoInfoSide_mc

    They are on top of each other one layer so that the fake Z ordering works.
    so you need to use arrange send to back to work on the other one.

    I need to display the first <info> item from the xml in videoInfoSide_mc.info_txt when the movie loads.

    click the circular arrow to flip the mc
    notice no text first time
    click a button on the list and flip and you will see text is loaded

    thanks
    Mark

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center