How to call BitmapData from another function?


I can’t seem to call my bitmapData from another function, if the bitmapdata was made in a function in the first place. Anyone know why?

Here’s my code… If you chuck it into flash, it’ll run the function dd() and it’ll make a bitmapdata, however, if you try to trace it or call to it… You can’t… you get “undefined” back…

But if i were to take it out of a function and put the bitmapdata on the frame without a function enclosing it, it works fine…

import flash.display.BitmapData;
import flash.geom.Rectangle;
import flash.geom.Point;
import com.*;
function dd () {
    var super_map_bit = new BitmapData (50, 50, true, 0x00CCCCCC);
    meg ();
function meg () {
    trace (super_map_bit);
dd ();

Anyway know how I could call my bitmapdata when it’s generated by a function?