• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Tiling MovieClip in Actionscript 3

Explorer ,
Jan 31, 2009 Jan 31, 2009

Copy link to clipboard

Copied

Hi,

I am wokring on a movie and I want to tile a movieclip instead of a bitmap in AS3. I have figured out masking and the bitmap tiling in AS3, but am still encountering trouble finding a good solution for simply tiling an MC symbol across a set width and height in AS3.

Any help would be greatly appreciated.

Thanks in advance.

Justin
TOPICS
ActionScript

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 31, 2009 Jan 31, 2009

Copy link to clipboard

Copied

what's the difference between tiling with a bitmap and tiling with a movieclip? ie, what are you using that works for bitmaps and fails for movieclips?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 31, 2009 Jan 31, 2009

Copy link to clipboard

Copied

Hey,

I believe you can't turn Bitmaps into masks on top of other Bitmaps and I imagine they can't be scaled as well as vectors.

Best,

Justin

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jan 31, 2009 Jan 31, 2009

Copy link to clipboard

Copied

you certainly can use a bmp as a mask, and even mask another bmp object with it. this is common when using png24 image bmps or other formats that support an alpha channel. the key to successful alpha masking is to turn on the 'cacheAsBitmap' property of *both* objects.

although it is true that scaling or rotating bmps can look a bit rastered, turning on the 'smoothing' property will help this a great deal during those types of transitions.

however to tile any object within an area it's common to use a nested loop:

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 31, 2009 Jan 31, 2009

Copy link to clipboard

Copied

Thanks so much. I think this will do the trick. It's quite simple. My only other question is with as2 attachmove is now gone.

If you want the mc you want to tile to stay offscreen in the library until its tiled then would you use the addchild command with the loop? Does that automatically handle the depths of all the indivdual tiles?

Best,

Justin

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 31, 2009 Jan 31, 2009

Copy link to clipboard

Copied

yes, you could and yes.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 31, 2009 Jan 31, 2009

Copy link to clipboard

Copied

Hi,

Below I posted the code I have written so far. The commaTile_mc is a class and is in the Library like everything else that works.

However when I run the movie I get an error that the x and y are undefined propoerties in a static class type.

Hope this helps.

Thanks again.

Justin

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jan 31, 2009 Jan 31, 2009

Copy link to clipboard

Copied

LATEST
you will need to instantiate a 'new' object instance on each iteration of the loop so previous to the x and y values being adjusted declare:

var commaTile_mc = new commaTile();

note the name change above - you cannot use the same name for a reference and a Class so you will need to change on or the other. since you have commaTile_mc in the rest of your code you could just remove the _mc portion from you Class name (in the linkage... library window not the 'name' of the library clip)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines