A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Dynamic textfield masking with non-dynamic mask

  1. #1
    Senior Member
    Join Date
    Jul 2006
    Location
    San Jose, CA
    Posts
    334

    Dynamic textfield masking with non-dynamic mask

    I've searched and searched and came up empty.

    I'm creating a playlist for a music player, and I've got the song names displaying correctly in my songTitle holder MC, but there's limited space for the song names to be shown in, and I'm going to eventually have it inside a scrolling movieclip. Problem is, the text inside the textfields disappear when I try to add a mask to the movieclip they're being loaded into. I've tried adding all combos of embedFonts, antialias, and blendModes I ran into, to no avail. I even created a new AS3 file to make sure it's not something in my FLA.

    I don't need an actionscript created mask, and don't understand where I'm going wrong.

    So basically I'm asking how to mask dynamically created textfields with a non-dynamic (Flash IDE-made) mask.

    Code:
    for (var i:int = 1; i <= _size; i++) {
        var pl_artist:TextField = new TextField;
        //all embedFont = true and antiAlias commands no workie 
    }
    Thanks all.
    I (Love | Hate) Flash.
    ----
    Save a version back so others may help you!

  2. #2
    Senior Member
    Join Date
    Jan 2008
    Location
    UK
    Posts
    269
    Ive done this before and didnt have this problem. I didnt do anything special - just put the moving textfield into a movie clip, and masked the movieclip. Does the masking work properly if it's, say, just a shape rather than text? I assume you realise the mask shows whats beneath it (kind of counterintuitive - I'd expect it to hide whats underneath it hence the name mask!)

  3. #3
    Senior Member
    Join Date
    Jul 2006
    Location
    San Jose, CA
    Posts
    334
    You know, it must be something I'm doing. It doesn't feel right.
    Attached Files Attached Files
    I (Love | Hate) Flash.
    ----
    Save a version back so others may help you!

  4. #4
    Senior Member
    Join Date
    Jan 2008
    Location
    UK
    Posts
    269
    I'm not sure why that doesn't work. The way I would do it though (and it does work) is to prepare the text field in the Flash IDE first. You can set the formatting as desired, add it to a holder sprite, then keep it in the library so you can create an instance from code when and where needed, and set the text dynamically. The only problem with masking text I ever had this way is if you apply filters to the text, they are not applied if the charachter count goes too high. (I forget the exact number but it's in the hepl docs somewhere).

  5. #5
    Senior Member
    Join Date
    May 2004
    Posts
    226
    tField.cacheAsBitmap = true;

    Also, if you want to use a movieClip as a mask then you will have set its cacheAsBitmap = true as well.

  6. #6
    Senior Member
    Join Date
    Jul 2006
    Location
    San Jose, CA
    Posts
    334
    @ _Ric_ : Yea it kinda got past me too. I'm just digging into the document class so I'll look into that when I'm comfy

    @ v5000: I'll give it a go.
    I (Love | Hate) Flash.
    ----
    Save a version back so others may help you!

  7. #7
    Senior Member
    Join Date
    Jul 2006
    Location
    San Jose, CA
    Posts
    334
    So it seems we're back to this.

    I solved the other one, at least for now. This time, there's an added step. On the same project I'm loading 2 different gallery swfs into the main movie depending on which link (pics/video) the user chooses. I've created an ImageLoader class that links easily with a moveclip of my choosing, an upon calling it it loads the image and displays the progress percentage.

    Now, it would seem that flash doesn't display the text, and I can only guess it's an embedding problem. The text is there, it really is. I don't want to fudge the class and make it a progress bar instead, but I suppose it may come to that.

    So the question:

    Is it actually possible to get the text to show from a loaded swf under a mask?

    Pseudo Hierarchy:
    Code:
    Main.swf has fonts embedded and in Library
          -Masked MC (masked by shape, no MC or bitmap)
          -Loading an external swf on same domain
                 -Loadee swf has fonts embedded and in Library
    I still don't get why a simple task like this is so...sigh. Calm. Calm is good.

    Thanks.
    I (Love | Hate) Flash.
    ----
    Save a version back so others may help you!

  8. #8
    Senior Member
    Join Date
    Jul 2006
    Location
    San Jose, CA
    Posts
    334
    Amazing. Abso*****lutely amazing.

    There's a lotta people out there saying "oooh nooooo, this line is for Flex oooonllllyyyyy".

    There's a lot I'd like to say to them. This line to the rescue in the AS file.

    Code:
    [Embed(source="C:\WINDOWS\Fonts\Standard0751", fontFamily="standard")]
    I (Love | Hate) Flash.
    ----
    Save a version back so others may help you!

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