javascript calling flex