# Tricky RandomBG function: Query

**URL:** <https://forum.kirupa.com/t/tricky-randombg-function-query/67844>\
**Category:** flash\
**Created:** [October 20, 2004, 3:30am UTC](https://forum.kirupa.com/t/tricky-randombg-function-query/67844 "2004-10-20T03:30:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chockybickyman](https://avatars.discourse-cdn.com/v4/letter/c/7bcc69/32.png) [@chockybickyman](https://forum.kirupa.com/u/chockybickyman)\
**Post date:** [October 20, 2004, 3:30am UTC](https://forum.kirupa.com/t/tricky-randombg-function-query/67844/1 "2004-10-20T03:30:05Z")

</div>

I have came across a tricky situation to find a code for:

The following is a code i have generated for displaying random frames when a movie loads. (this is contained in the onClipEvent load)

**function randomBg() {  
//generate random BG based on random frames within the MC  
randFrame = random(3)+1;  
bg\_graphics.gotoAndStop(randFrame);  
}**  
**stop();**

There are 3 movie clips placed on each frame of this movie clip (bg\_graphics). Each of these movie clips has a short animation that i want to trigger somewhere later in the script.

Q: How could i target this randomly generated frame/movie clip to gotoAndPlay frame 2.

Do i need to generate an ID name for this bg\_graphics moive clip?  
Please help, anyone???

Cheers  
Peter.D
